|
Latest post 08-22-2008 1:36 AM by modchip. 6 replies.
-
03-08-2007 5:49 PM
|
|
-
modchip


- Joined on 02-09-2006
- Ivalice
- Posts 710
- Points 10,110
|
Hi again... Radio boxes & checkboxes. How do you get the selections/choices in assembly language? I've searched all over some asm sites and some books, but I cannot find one that is easy to read and understand. If it's no hassle to you guys, could you please give some nice examples about these to controls? Thank you very much (again)! Regards, m0ds
|
|
-
-
cvega


- Joined on 11-25-2005
- Posts 497
- Points 8,455
|
Re: Assembly Choices
Answer
Checkbox and Radiobutton are all types of "button" class. For checkbox, add "button" window with style BS_CHECKBOX or BS_AUTOCHECKBOX. For radiobutton, add "button" window with style BS_RADIOBUTTON or BS_AUTORADIOBUTTON. Cheers, -chris
Chris Vega
This posting is provided "AS IS" with no warranties, and confers no rights
My Weblog| Visit MSDN Community
|
|
-
-
modchip


- Joined on 02-09-2006
- Ivalice
- Posts 710
- Points 10,110
|
ok superman, will try that. Thank you! -"Batman"
|
|
-
-
modchip


- Joined on 02-09-2006
- Ivalice
- Posts 710
- Points 10,110
|
Re: Assembly Choices
Answer
cvega:Checkbox and Radiobutton are all types of "button" class.
For checkbox, add "button" window with style BS_CHECKBOX or BS_AUTOCHECKBOX. For radiobutton, add "button" window with style BS_RADIOBUTTON or BS_AUTORADIOBUTTON.
Cheers,
-chris
Ok Chris! I got the Radio buttons to work now, thanks! I want to follow-up the question. The scenario is that I want the messagebox to appear only after I click the ok button, the code below does not work but... .386 ... .data caption db "Information",0
yes_message db "You chose yes!",0
no_message db "You chose no!",0 ... .code start: ... .elseif uMsg==WM_COMMAND .if wParam==IDC_BUTTON_MAIN_OK .if wParam==IDC_RADIO_YES push 0 push offset caption push offset yes_message push hWin call MessageBox .elseif wParam==IDC_RADIO_NO push 0 push offset caption push offset no_message push hWin call MessageBox .endif ...
.endif ... end start
... I tried this one, cause I'm out of ideas, but it works. Is there a better way to do what the working code below does? .386 ... .data caption db "Information",0 yes_message db "You chose yes!",0 no_message db "You chose no!",0 final_message db 128 dup(0) ... .code start: ... .elseif uMsg==WM_COMMAND .if wParam==IDC_BUTTON_MAIN_OK push 0 push offset caption push offset final_message push hWin call MessageBox .elseif wParam==IDC_RADIO_YES push offset yes_message
push offset final_message
call lstrcpy .elseif wParam==IDC_RADIO_NO push offset no_message push offset final_message call lstrcpy ... .endif ... end start
Thanks again dude! I really appreciate your help. :D Regards, m0ds

|
|
-
-
modchip


- Joined on 02-09-2006
- Ivalice
- Posts 710
- Points 10,110
|
Hi,
I tried to send the BM_CHECK message whenever a checkbox is checked or unchecked. Is the method I'm doing correct? Anyways I searched MSDN for the SendMessage function and...
lResult = SendMessage( // returns LRESULT in lResult (HWND) hWndControl, // handle to destination control (UINT) BM_GETCHECK, // message ID (WPARAM) wParam, // = 0; not used, must be zero (LPARAM) lParam // = 0; not used, must be zero );
...which in MASM32 I believe is invoke SendMessage, hWin, BM_GETCHECK, 0, 0 -- where can I find the lResult/Return value? In eax?
Also, the return value will be either BST_CHECKED or BST_UNCHECKED according to the doc, is it literally "BST_CHECKED" and "BST_UNCHECKED"?
Thank you!
|
|
-
-
cvega


- Joined on 11-25-2005
- Posts 497
- Points 8,455
|
Yes, the result will be in EAX.
.IF eax == BST_CHECKED ; do something .ENDIF
Cheers,
-chris
Chris Vega
This posting is provided "AS IS" with no warranties, and confers no rights
My Weblog| Visit MSDN Community
|
|
-
-
modchip


- Joined on 02-09-2006
- Ivalice
- Posts 710
- Points 10,110
|
Hmmm... yeah, I did this already, but the problem is that whether it is ticked or not, it always returns BST_UNCHECKED... here's the current code on that part...
- ...
- mChecked db "Checked!",0
- mCleared db "Cleared!",0
- ...
- .if wParam==IDC_BUTTON_MAIN_OK
- .if eax==BST_CHECKED
- invoke MessageBox, hWin, addr mChecked, addr caption, MB_OK
- .else
- invoke MessageBox, hWin, addr mCleared, addr caption, MB_OK
- .endif
- .elseif wParam==IDC_CHECKBOX1
- invoke SendMessage, hWin, BM_GETCHECK, 0, 0
- ...
- end start
Thanks!
|
|
Page 1 of 1 (7 items)
|
|
|