News:

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

ChooseColor Causes application to die

Started by travism, May 17, 2009, 09:13:29 AM

Previous topic - Next topic

travism

So I decided to use a choosecolor dialog box, mind you im using the newest headers from the goasm headers project. Here is my code, It doesnt give me any errors but when i click the button for it to show the colors dialog box it causes the program to exit with error.


DATA SECTION
           cColor  CHOOSECOLORA <?>            ; I have to choose CHOOSECOLORA or CHOOSECOLORW, or is it gives me a error.
CODE SECTION
          cmp d[uMsg],WM_COMMAND
          jne >TRUE
                   cmp d[uMsg],IDC_CHOOSECOLORS
                    jne >FALSE

                            invoke ZeroMemory,addr cColor,sizeof(cColor)
                            mov     d[cColor.lStructSize],sizeof(cColor)
                            push    [hWnd]
                            pop      [cColor.hwndOwner]
                            mov      d[cColor.Flags],CC_PREVENTFULLOPEN
                           invoke  ChooseColor,addr cColor
          jmp >TRUE


Im guessing it has to do with how the structure was defined in the headers? or am I doing something wrong here?

Mark Jones

Quote from: travism on May 17, 2009, 09:13:29 AM

CODE SECTION
          cmp d[uMsg],WM_COMMAND
          jne >TRUE



As Utillmasm would say, "Oh my fo!" :bg

TRUE and FALSE should be defined to be numeric constants, do these branches work as expected? I see no .LABEL (local label) declarations. Perhaps try making the conditions more like the form of:
http://www.masm32.com/board/index.php?topic=11097.msg85520#msg85520

Do you use OllyDbg? If so, try stepping through the offending code. That's the easiest way to tell exactly what is going on.
"To deny our impulses... foolish; to revel in them, chaos." MCJ 2003.08