Hello,
I am working on a simple program that pops up a message box that displays OK and NO.. i was just wondering what to look for to tell what option the user clicked on. Im sure i could figure it out if i knew what to look for... any help is appreciated Thanks


Dug
Posted on 2002-04-09 03:41:16 by zealott
Afternoon, zealott.

test eax for IDOK or IDNO.

Cheers,
Scronty
Posted on 2002-04-09 05:20:32 by Scronty
Im new to this flavor of assembly (used to 16bit assembly) but anyway would you give an example please... also handy would be in what method this would go in.. my guess would be right after the message box is created, but then again im not that sure.. thanks agian for the help
Posted on 2002-04-09 23:45:13 by zealott
[size=9]

.586
.MODEL FLAT, STDCALL
OPTION CASEMAP:NONE

INCLUDE \masm32\include\windows.inc
INCLUDE \masm32\include\kernel32.inc
INCLUDELIB \masm32\lib\kernel32.lib
INCLUDE \masm32\include\user32.inc
INCLUDELIB \masm32\lib\user32.lib

.CODE

Yes DB "You clicked Yes.", 0
No DB "You clicked No.", 0

Start:

invoke MessageBox, 0, 0, 0, MB_YESNO
cmp eax, IDYES
jne @@UserClickedNo

invoke MessageBox, 0, OFFSET Yes, 0, 0
jmp @@ExitProgram

@@UserClickedNo:

invoke MessageBox, 0, OFFSET No, 0, 0

@@ExitProgram:

invoke ExitProcess, 0

END Start[/size]


:)
Posted on 2002-04-09 23:52:03 by stryker
Thanks.. very extremely helpful
hehe
Posted on 2002-04-10 00:02:15 by zealott
Just remember: after any win32 api call the return value will always be in EAX. To make sure you know what to check on those returned values on every win32 api calls, there are online win32 reference or get the platform SDK.
Posted on 2002-04-10 00:17:08 by stryker