i open a dialogbox that contains two edit controls, and two buttons. One button has BS_DEFPUSHBUTTON style ... so it get focus ... but i want the first edit control to get the focus and then the user push the default button and continue ... ideas?
in your wm_create use the following api to set focus to your editbox when your program loads. invoke SetFocus,hEditHandle smurf
Or (if its defined in a .res file):
invoke SendDlgItemMessage, hDlg, EDIT1, WM_SETFOCUS, NULL, NULL
According to standard windows doc the application gets handle (in wParam) of control to receive focus in WM_INITDIALOG and should return FALSE if it wants another control to receive focus (in which case the application should have called SetFocus() before returning from WM_INITDIALOG). There is also a misunderstanding of flag BS_DEFPUSHBUTTON. A button defined with this flag will not automatically receive the focus on start of a dialog. Instead it will receive a WM_COMMAND/BN_CLICKED message if the user presses
This message was edited by japheth, on 7/5/2001 6:56:01 AM
I try: call GetDlgItem, EDIT1 call SetFocus,EAX didnt work ... then try: call SendDlgItemMessage, hDlg, EDIT1, WM_SETFOCUS, NULL, NULL well, the cursor appears in the editbox but i cant write anything into it ... until i push oen time the shift key. :?
unknow, Two things, change the order of the controls in the RC file so that the edit control you want to have focus is first, then change the style of the button to a normal one. Should do the job for you OK. Regards, firstname.lastname@example.org
i tried ... but fails :( ...
post the source code of the dialog box proc.