Announcement

Collapse
No announcement yet.

why I can't close it?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Edwin Knoppert
    replied
    It's Windows, it doesn't want you to call a msgbox during WM_DESTROY.
    (And possibly other messags as well)

    Search for WM_SYSCOMMAND to prevent closing a form.

    Leave a comment:


  • Guest
    Guest started a topic why I can't close it?

    why I can't close it?

    #COMPILE EXE
    #DIM ALL
    %USEMACROS =1 'if don't write the .exe will become big
    #INCLUDE "win32api.inc"
    FUNCTION PBMAIN () AS LONG
    LOCAL hDlg AS DWORD

    DIALOG NEW 0,"Caption",,,220,140,%WS_CAPTION OR %WS_SYSMENU,0 TO hdlg
    CONTROL ADD BUTTON,hDlg,%IDOK,"&OK",112,122,50,14
    CONTROL ADD BUTTON,hDlg,%IDCANCEL,"E&xit",166,122,50,14
    DIALOG SHOW MODAL hdlg,CALL Dlgproc()
    END FUNCTION
    CALLBACK FUNCTION DlgProc() AS LONG
    LOCAL l AS INTEGER
    SELECT CASE AS LONG CBMSG
    CASE %WM_INITDIALOG 'happen before dialog show
    MSGBOX "start"
    CASE %WM_DESTROY

    MSGBOX("out") 'I find the msgbox can't close!

    CASE %WM_COMMAND
    SELECT CASE AS LONG CBCTL
    CASE %IDOK
    IF CBCTLMSG=%BN_CLICKED THEN
    MSGBOX "current time is: " & TIME$ & $CRLF & _
    "current date is: "& DATE$,_
    %MB_TASKMODAL,"Time and date"
    END IF
    CASE %IDCANCEL
    IF CBCTLMSG=%BN_CLICKED THEN
    DIALOG END CBHNDL
    END IF
    END SELECT
    END SELECT
    END FUNCTION
    '======================================
    endless loop,why ?
Working...
X