hi fellows, i'm new in this game and because i wanna learn i started playing around with some code and i set myself a goal for today, i wanna make a progi with 2 buttons the one sais yes and the other one sais no when u click no, the button is supposed to jump someplace else, if you try to click it at the new location it's supposed to jump back to the old one. i'm trying to do that all night already, but i can't figure out how it works, so maybe you guys can help me here's my code so far with resource file:

.model flat,stdcall 
option casemap:none 


include \masm32\include\windows.inc 
include \masm32\include\user32.inc 
include \masm32\include\kernel32.inc 
includelib \masm32\lib\user32.lib 
includelib \masm32\lib\kernel32.lib 

DlgName db "Buba",0 
ButtonClass db "button",0

hInstance HINSTANCE ? 
CommandLine LPSTR ? 
hwndButton HWND ? 


IDC_YES     equ 3001 
IDC_NO1     equ 3002 
IDC_NO2     equ 3003

    invoke GetModuleHandle, NULL 
    mov    hInstance,eax 
    invoke DialogBoxParam, hInstance, ADDR DlgName,NULL, addr DlgProc, NULL 
    invoke ExitProcess,eax 
    DlgProc proc hWnd:HWND, uMsg:UINT, wParam:WPARAM, lParam:LPARAM 
    .IF uMsg==WM_CLOSE 
        invoke EndDialog, hWnd,NULL 
        mov eax,wParam 
        mov edx,wParam 
            shr edx,16 
            .IF dx==BN_CLICKED 
                     .IF ax==IDC_YES 
                      invoke EndDialog, hWnd,NULL 
        mov eax,FALSE 
    mov eax,TRUE 
DlgProc endp 
end start 


#include "\masm32\include\resource.h" 

#define IDC_YES            3001 
#define IDC_NO1            3002
#define IDC_NO2            3003                                

Buba DIALOG LOADONCALL PURE 10, 10, 205, 60 
CAPTION "Function" 
FONT 10, "Arial"
        DEFPUSHBUTTON   "No", IDC_NO1,    50,10,52,13
        DEFPUSHBUTTON   "No", IDC_NO2,    100,10,52,13
        DEFPUSHBUTTON   "No", IDC_YES,    141,10,52,13
        CTEXT        "blabla", -1, 22, 9, 160, 8
        CTEXT        "blabla", -1, 22, 20, 160, 8
thanks so far Regards Typhoon (added code tags -- Ernie) This message was edited by Ernie, on 3/26/2001 2:27:17 PM
Posted on 2001-03-26 02:27:00 by Typhoon
Typhoon Have a look in here: http://www.fhills.starway.net.au/~forge/forge1.zip Is this what you are looking for??? forge
Posted on 2001-03-26 04:34:00 by forge
What you seem to be trying to do, is not actually move a button, but hide one button, then showing another.... This is slightly different from the task you have described, and will be approched differently. All you have is the following case:

   ;Get Handle of NO1, and hide this window (button)
   invoke GetDlgItem, hWnd, IDC_NO1
   invoke ShowWindow, eax, SW_HIDE

   ;Get Handle of NO2, and show this window (button)
   invoke GetDlgItem, hWnd, IDC_NO2
   invoke ShowWindow, eax, SW_SHOW

   ;Like IDC_NO1 but in reverse
   ;Get Handle of NO2, and hide this window (button)
   invoke GetDlgItem, hWnd, IDC_NO2
   invoke ShowWindow, eax, SW_HIDE

   ;Get Handle of NO1, and show this window (button)
   invoke GetDlgItem, hWnd, IDC_NO1
   invoke ShowWindow, eax, SW_SHOW
This code could be improved by only getting the handles of the two buttons on initialisation (WM_INITDIALOG), and using the stored results. However, you suggested moving the one button, this would be done with the MoveWindow or SetWindowPos APIs. Mirno
Posted on 2001-03-26 04:46:00 by Mirno
Mirno, this is how is done, it is move...

    .if uMsg == WM_LBUTTONDOWN
        invoke SendMessage,hBtn3,BM_SETIMAGE,0,hBmp4
        .if flip==0
			invoke	 ShowWindow,hBtn3, SW_HIDE	
			invoke	 MoveWindow,hBtn3,188,120,50,46,1 
			invoke	 ShowWindow,hBtn3, SW_SHOW	
			inc flip
			invoke	 ShowWindow,hBtn3, SW_HIDE	
			invoke	 MoveWindow,hBtn3,8,165,50,46,1  
			invoke	 ShowWindow,hBtn3, SW_SHOW
			mov flip,0	
    .elseif uMsg == WM_LBUTTONUP   
Posted on 2001-03-26 05:06:00 by forge
thanks guys, it works great with just hiding one of the buttons Regards Typhoon
Posted on 2001-03-26 19:56:00 by Typhoon
forge, can you show me your forge.exe code? I liked it. :)
Posted on 2001-03-27 04:50:00 by wolfao
wolfao, it is in your mailbox.
Posted on 2001-03-27 05:24:00 by forge