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?
Posted on 2002-04-28 18:25:40 by Framework
Or even just remove the buttons??? Sorry I'm a novice at this.
Posted on 2002-04-28 18:38:14 by Framework
The ShowWindow should do what you want. Send SW_HIDE to hide a button window, SW_SHOW to restore it.

Cheers,

-Chalain
Posted on 2002-04-28 18:43:29 by 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).
Posted on 2002-04-28 18:47:04 by Framework
.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???
Posted on 2002-04-28 19:10:24 by Framework
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
Posted on 2002-04-28 20:33:41 by 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?
Posted on 2002-04-28 21:04:44 by Framework
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... :(
Posted on 2002-04-28 21:06:26 by Framework
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:
.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
Posted on 2002-04-28 22:15:50 by smurf
How do I give each button a handle?
Posted on 2002-04-28 22:31:32 by Framework
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
Posted on 2002-04-28 23:16:39 by chorus
Thanks everyone for answering my playskool questions. It all works! Thank you thank you thank you! :D
Posted on 2002-04-28 23:49:58 by Framework