News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Confim quit message box

Started by runtimeTerror, February 02, 2005, 06:12:15 PM

Previous topic - Next topic

runtimeTerror

The first question I have is how can I catch the clicking of the cancel/OK button. And what is the purpose of the WndProc endP statement? I thought that the end label has to be the same as the start label. So instead, why is it not End WndProc?

Thanks in advance!


WndProc proc hWnd:HWND, uMsg:UINT, wParam:WPARAM, lParam:LPARAM
    .IF uMsg==WM_DESTROY                           ; if the user closes our window
        invoke PostQuitMessage,NULL
            .IF wParam==50
                ExitProcess proto uExitCode:DWORD
            .ELSE
                ret
            .ENDIF         
    .ELSE
        invoke DefWindowProc,hWnd,uMsg,wParam,lParam     ; Default message processing
        ret
    .ENDIF
    xor eax,eax
    ret
WndProc endp


P1

runtimeTerror,

Use your help files on the Windows API and google for answers it will speed up your learning curve.

Below is the return values you can test ( in eax ) after calling/invoking the MessageBox function, which has the Ok & Cancel buttons.
Return Value

The return value is zero if there is not enough memory to create the message box.
If the function succeeds, the return value is one of the following menu-item values returned by the dialog box:

Value   Meaning
IDABORT   Abort button was selected.
IDCANCEL   Cancel button was selected.
IDIGNORE   Ignore button was selected.
IDNO   No button was selected.
IDOK   OK button was selected.
IDRETRY   Retry button was selected.
IDYES   Yes button was selected.
If a message box has a Cancel button, the function returns the IDCANCEL value if either the ESC key is pressed or the Cancel button is selected. If the message box has no Cancel button, pressing ESC has no effect.


QuoteI thought that the end label has to be the same as the start label. So instead, why is it not End WndProc?
[Procedure Name] with 'proc' in the beginning and 'endp' in the end is the syntax for procedures in MASM sources.

QuoteSo instead, why is it not End WndProc?
  The 'end' directive is use to terminate source files.  Another syntax feature of MASM.  What programming language do you normally use??
  Syntax:   END [address]

  Description:

     Marks the end of a source file and optionally indicates the
     program load address. The optional <address> is a label or
     expression identifying where program execution begins. You can
     define <address> only once in a program, usually in the main
     module.

     You cannot specify <address> if you have used the .STARTUP
     directive, which automatically sets a start address. If you are

     linking with a high-level language, the start address is
     typically set by that language's compiler.

     END also closes the last segment in the source file.

Regards,  P1  :8)