DevPinoy.org
A Filipino Developers Community

>>> First two to make 3 wins! <<<

Assembly Choices

rated by 0 users
This post has 6 Replies | 0 Followers

Top 10 Contributor
Posts 751
Points 10,140
modchip Posted: 03-08-2007 5:49 PM
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

  • Filed under:
  • | Post Points: 20
Top 10 Contributor
Posts 498
Points 8,375
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
  • | Post Points: 35
Top 10 Contributor
Posts 751
Points 10,140
ok superman, will try that. Thank you!

-"Batman" Stick out tongue

  • Filed under:
  • | Post Points: 5
Top 10 Contributor
Posts 751
Points 10,140
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


  • Filed under:
  • | Post Points: 5
Top 10 Contributor
Posts 751
Points 10,140

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!

 

Top 10 Contributor
Posts 498
Points 8,375

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
  • | Post Points: 20
Top 10 Contributor
Posts 751
Points 10,140

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...

  1. ...
  2. mChecked db "Checked!",0
  3. mCleared db "Cleared!",0
  4. ...
  5. .if wParam==IDC_BUTTON_MAIN_OK
  6.     .if eax==BST_CHECKED
  7.         invoke MessageBox, hWin, addr mChecked, addr caption, MB_OK
  8.     .else
  9.         invoke MessageBox, hWin, addr mCleared, addr caption, MB_OK
  10.     .endif
  11. .elseif wParam==IDC_CHECKBOX1
  12.     invoke SendMessage, hWin, BM_GETCHECK, 0, 0
  13. ...
  14. end start


Thanks!

 

Page 1 of 1 (7 items) | RSS

Copyright DevPinoy 2005-2008