News:

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

Searching Error in source file

Started by ToutEnMasm, August 11, 2011, 09:22:05 AM

Previous topic - Next topic

ToutEnMasm

Hello,
It is a modify sample coming from here
http://www.masm32.com/board/index.php?topic=17169.0
I have just added a proc who display the error messge in all language and in text,see badmdi.
Choose the one you prefered.
I have also put a new source code (mdi who works) ,resource file is from dedndave

jj2007

Quote from: ToutEnMasm on August 11, 2011, 09:22:05 AM
I have just added a proc who display the error messge in all language and in text, see badmdi.

The lazy alternative to Retrieve_Error_Msg:
MsgBox 0, LastError$(), "create child window failed", MB_OK


\masm32\macros\macros.asm:
      LastError$ MACRO
        IFNDEF @@_e_r_r_o_r_@@
          .data?
            @@_e_r_r_o_r_@@ db 1024 dup (?)
          .code
        ENDIF
        pushad
        pushfd
        invoke GetLastError
        mov edi,eax
        invoke FormatMessage,FORMAT_MESSAGE_FROM_SYSTEM,
                             NULL,edi,0,ADDR @@_e_r_r_o_r_@@,1024,NULL
        popfd
        popad
        EXITM <OFFSET @@_e_r_r_o_r_@@>
      ENDM


Hutch even preserves the flags :bg

dedndave

that may be prudent in an error handler

ToutEnMasm

I have made it a little better adding it a window who couldn't failed to open.The messagebox can.
Code is more longer and can be included in your source file.
If you can made it better (for example  adding unicode support) ,be kind ,post it here.