How to give an edit box focus on application startup

I'd like to give an edit box focus when my program starts but I'm having a hard time figuring it out. Everything I've found uses something like TEXTBOXNAME.Focus() or TEXTBOXNAME.Select() but I haven't made my edit box that way. I just placed it on the form from the toolbox.
closed account (jwkNwA7f)
You can use SetFocus().
1
2
3
4
case WM_CREATE:
     myEdit = CreateWindow("edit", "", WS_CHILD | WS_VISIBLE | WS_BORDER, 0, 0, 
                      100, 25, hwnd, NULL, NULL, NULL);
     SetFocus(myEdit);


Hope this helped!
I've never seen code like that. How would I link my edit box to this code? What is "myEdit"? Is that the handle to my edit box? What is that code doing?
closed account (jwkNwA7f)
Oh, are using MFC?

EDIT: I was assuming WinAPI, sorry.
EDIT 2: Just noticed,
I just placed it on the form from the toolbox.

it looks like you are using windows forms. Sorry, I can't help with that.
Last edited on
Topic archived. No new replies allowed.