Hello World

Do anyone know how to catch an MESSAGE BOX Error. Would SEH catch this or is there something more simple that can. The Title Bar reads *Error* but the app still runs after i click the message box off so i know it's Windows simplest error message but i don't know anything about Handling Errors . I need to handle it, I got to give up on working around it because it seems impossible for me to do right now...

Thanks
Posted on 2002-06-19 11:45:40 by cmax
hm, "message box error"? You mean the standard GPF thingy?
If so, yes, just put up a SEH. There's 'enough' documentation about
it which is even easy to find.
Posted on 2002-06-19 11:51:04 by f0dder
That's "normal". The error string on the title means that the you specified NULL for the title bar parameter. The "error handling" was handled inside the messagebox function. If you want to handle this kind of stuff just compare the first byte of the string and check if it's 0, if it is, handle this error.


cmp BYTE PTR [NameOfString], 0
jne @F
;error here
;you can exit the proggy or something.
@@:
;execute the message box
If it's a GPF then do the SEH thingy. :)


forget about the compare stuff above, it doesn't work :) If you have a null terminated string it will just print an empty title not the error you mentioned. But if it is setup like this:


mymbox PROC lpszTitleString:DWORD
cmp lpszTitleString, NULL
jne @F
ret
@@:
invoke MessageBox, NULL, OFFSET MsgBoxText, lpszTitleString, MB_OK
ret
mymbox ENDP

push NULL
call mymbox ;This one will not execute the messagebox

push OFFSET MsgBoxTitle
call mymbox ;This one will execute
Then this will work
Posted on 2002-06-19 11:56:02 by stryker
I been switching and adding new stuff around for days now thinking i could fix it on my own but it only did the same thing. It's time for me to learn about Error Handling anyway. This will get me going in a new direction.

stryker, I think that is the perfect solution my problem. When i get into SEH I want to do the Profile thing first i think.

Thanks a TON :) :) :)
Posted on 2002-06-19 12:20:30 by cmax
Stryker, removing the symptoms instead of curing the problem? :)
Posted on 2002-06-19 12:26:44 by f0dder
:grin: Yep! :grin:
Posted on 2002-06-19 12:28:40 by stryker
That file works great , you don't even have to push just straight calls in my case in a dll i am working on.

Can you save (since i get it anyway) the Error text from your own 0 terminated ERROR MessageBox to a buffer.

f0dder, i plan to find it and fix it properly but now i want to use those error message to my advantage. Posted on 2002-06-19 22:30:17 by cmax