News:

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

No Button?

Started by Neil, October 08, 2011, 03:58:40 PM

Previous topic - Next topic

Neil

I have a finished program written in console mode & last year started  a project to see how it would perform as a gui, I've completed the 'skeleton' outline all menus working OK etc. Part of the program requires 10 superclassed edit boxes that will only accept digits 0 to 9, this works OK so I've decided now to put cancel & OK buttons also on the main window. I looked at Iczelion's tutorials & decided that it was a good place to start. I used the following piece of code, much the same as in the tutorial except for the placement, but the button doesn't show, it assembles OK & ShowLastError says success, so why can't I see a button? Here's the code :-

            invoke CreateWindowEx, NULL, ADDR ButtonClassName,ADDR ButtonText,\
                        WS_CHILD or WS_VISIBLE or BS_DEFPUSHBUTTON,\
                        325,400,140,25,hWnd,ButtonID,hInstance, NULL
            mov hwndButton,eax


dedndave

button style flags
http://msdn.microsoft.com/en-us/library/windows/desktop/bb775951%28v=VS.85%29.aspx

then, like most windows
        INVOKE  ShowWindow,eax,SW_SHOW

jj2007

Quote from: dedndave on October 08, 2011, 04:13:40 PM
        INVOKE  ShowWindow,eax,SW_SHOW
WS_VISIBLE should be enough.

dedndave

Jochen's probably right - lol
wellllll
perhaps it is the position
how big is the parent window ?

ToutEnMasm

Verify all your arguments,the value of the returned handle (if zero call getlasterror).
Last modifie the styles ,WS_CHILD can be responsible.


dedndave

also, make sure ADDR ButtonClassName points to a string that says "Button",0   :bg

Neil

Thanks for all your suggestions, I'll check them out tomorrow & report back the result

Neil

Solved! Dave it was your last post that did it, when I checked in .data I'd missed the ,0 off the end of ButtonClassName db "button". It was as simple as that, but boy did it cause me some head scratching.

dedndave

Yves' answer would have found it for you, as well
it was looking for a class that had not been registered
it would probably have returned 0, with GetLastError of ERROR_INVALID_PARAMETER (guessing - lol)