Let's say you have a standard default window with 2 buttons. I have setup the buttons to interactively display text when being pushed, but I want to make the buttons disappear, it's possible right??? Little help?
Or even just remove the buttons??? Sorry I'm a novice at this.
The ShowWindow should do what you want. Send SW_HIDE to hide a button window, SW_SHOW to restore it.
Cheers,
-Chalain
Cheers,
-Chalain
Sorry, how do you implement that command? I should stick it under the section that checks if the button has been pushed, yes? (Since I want the button to disappear once pushed).
.IF ax==ButtonID
shr eax,16
.IF ax==BN_CLICKED
invoke SendMessage,hWnd,WM_COMMAND,IDM_GETTEXT,0
INVOKE ShowWindow,ButtonID,SW_HIDE
INVOKE UpdateWindow,ButtonID
invoke InvalidateRect, hWnd,NULL,TRUE
.ENDIF
.ENDIF
This is what I have for my button being pushed, but it doesn't do anything... I'm I implementing the SW_Hide wrong???
shr eax,16
.IF ax==BN_CLICKED
invoke SendMessage,hWnd,WM_COMMAND,IDM_GETTEXT,0
INVOKE ShowWindow,ButtonID,SW_HIDE
INVOKE UpdateWindow,ButtonID
invoke InvalidateRect, hWnd,NULL,TRUE
.ENDIF
.ENDIF
This is what I have for my button being pushed, but it doesn't do anything... I'm I implementing the SW_Hide wrong???
FrameWork, is ButtonID a handle to the button window? It's probably a resource ID I'm guessing.. something you set, right? Or did you create the button manually through CreateWindowEx. Cause if it's not a handle, I doubt ShowWindow is going to reach your button..
Unless there's a way to get a window handle from the resouce ID... you'd have to create the button windows manually.
--Chorus
Unless there's a way to get a window handle from the resouce ID... you'd have to create the button windows manually.
--Chorus
I created the button in WM_Create
ELSEIF uMsg==WM_CREATE
invoke CreateWindowEx,NULL, ADDR ButtonClassName,ADDR ButtonText,\
WS_CHILD or WS_VISIBLE or BS_DEFPUSHBUTTON,\
75,70,140,25,hWnd,ButtonID,hInstance,NULL
mov hwndButton,eax
invoke CreateWindowEx,NULL, ADDR ButtonClassName,ADDR ButtonText2,\
WS_CHILD or WS_VISIBLE or BS_DEFPUSHBUTTON,\
225,70,140,25,hWnd,ButtonID2,hInstance,NULL
mov hwndButton,eax
Yah I believe it's a resource ID. How would I create a button manually? Where would that code go to manually create a button?
ELSEIF uMsg==WM_CREATE
invoke CreateWindowEx,NULL, ADDR ButtonClassName,ADDR ButtonText,\
WS_CHILD or WS_VISIBLE or BS_DEFPUSHBUTTON,\
75,70,140,25,hWnd,ButtonID,hInstance,NULL
mov hwndButton,eax
invoke CreateWindowEx,NULL, ADDR ButtonClassName,ADDR ButtonText2,\
WS_CHILD or WS_VISIBLE or BS_DEFPUSHBUTTON,\
225,70,140,25,hWnd,ButtonID2,hInstance,NULL
mov hwndButton,eax
Yah I believe it's a resource ID. How would I create a button manually? Where would that code go to manually create a button?
I've been looking through the tutorials on this page and have been cutting code together... but I haven't found an example that created a button any other way then the one above... :(
hi Framework welcome to the board,
anyways you are doing something minor. instead of using your button controls ID (ButtonID) you need to use the buttons handle (hwndButton). so it should look something like this:
anyways you are doing something minor. instead of using your button controls ID (ButtonID) you need to use the buttons handle (hwndButton). so it should look something like this:
.IF uMsg == WM_COMMAND
.if lParam == hwndButton
mov eax,wParam
shr eax,16
.if ax == BN_CLICKED
invoke SendMessage,hWnd,WM_COMMAND,IDM_GETTEXT,0
invoke ShowWindow,hwndButton,SW_HIDE
.endif
.end
How do I give each button a handle?
For each call to CreateWindowEx you get the handle of the window (button) returned in eax. That's what the mov hwndButton,eax does -- it saves the window handle for future reference. However, you're overwriting the first window handle with the second mov hwndButton,eax. The solution is simply to declare another variable that will accept the second button handle, like hwndButton2. (Something more meaningful will make your code easier to read and follow... like hPlayButton or hStopButton, or whatever your buttons do).
You can use these handles for ShowWindow instead of ButtonID and they will Show/Hide the corresponding button.
--Chorus
You can use these handles for ShowWindow instead of ButtonID and they will Show/Hide the corresponding button.
--Chorus
Thanks everyone for answering my playskool questions. It all works! Thank you thank you thank you! :D