I was trying to understand how radio button works and wrote simple example and saw very starnge thing.I set radio button during WM_INIT and I can check it even When I sendmessage BM_GETCHECK I get 1.However If I try to get from another place when I send BM_GETCHECK it says 0.What I am doing wrong.Thanks.
Posted on 2002-12-13 12:53:39 by LaptoniC
LaptoniC, maybe im misreading your question. But what do you think
the message 'BM_GETCHECK' is used for? I mean ofcourse it would return '1'
on the box you just selected, and '0' on any other box. Since it will only return
'1' if the box your sending the message to is currently selected. ( ;) )
Posted on 2002-12-13 14:06:39 by natas
Hi LaptoniC

I checked it in Sice and it looks like your hlevel1 handle, which you save during WM_INITDIALOG, is corrupt by the time it gets to WM_COMMAND.

My guess is it's because you're using LOCAL variables for the handles in DlgProc and they get reinitialized or worse each time you enter the Messaging routine?

DlgProc proc hWin:HWND,....

Posted on 2002-12-13 14:44:07 by Kayaker
What can I say? I stand corrected. ( ;) ) I didnt check his source, I just
thought that he didnt know why the message didnt return '1' on other
items wich wasnt selected. ( :o )
Posted on 2002-12-13 14:51:00 by natas
Silly me :) Yep handles must be local.Thanks.
Posted on 2002-12-13 17:43:42 by LaptoniC
I have solved handles program but here is new one.I am trying to figure out why it happens but coulndt found an answer.
1) Open the program and hit TAB key
2)When Tab reaches option 2 program never endsly calls MessageBoxA

I tried to debug and saw that it doesnt return the program.Instead MessageboxExA api(sub function of MessageBoxA) calls MessageBoxA api again.What can be the reason ?.Thanks
Posted on 2002-12-15 06:31:51 by LaptoniC
if you call some sort of proc or something and the stack is off you can jump way off from were you want to be.

before you call the proc try calling pushad and before you return from the proc try popad

or make a few registries and move them manually into them. i dont think you will need to do that but
i have had to when i have made a program call on a dll that it never was made to use before and if
you do a pushad and a popad it can mess with the stack to much so i have to resort to moving all the
registries to dwords.

not sure if this will help but if its jumping out of you program. its most likely a stack problem
Posted on 2002-12-15 06:37:50 by devilsclaw
Looks like AUTORADIOBUTTON doesn't like tabs, it gets caught in a loop at the 2nd one and never cycles back to the other controls. If you change them to checkboxes it tabs OK.

You could try playing with declaring them as BS_RADIOBUTTON style (not AUTO). In this case I was able to get the tab key cycling back to the other controls but it treated the radiobuttons as one group and would only tab to the first one. If you could somehow declare them in your .rc file so they're not treated as a group it might work. If you really want the tab key to work you may have to go with checkboxes and turn them on and off programmatically (emulate the AUTO function of a group)

Posted on 2002-12-15 18:50:32 by Kayaker
Thanks for the reply.It is interesting that only MessageBoxA have this propertiy other apis I have tried or instructions in this region works.
Posted on 2002-12-16 19:44:54 by LaptoniC