I want to make program in WINApi -it is simple window with one textbox - if you will press key 'A',it jumps to textbox(like when you click on it,and then you will be able to write to it). Only thing I dont know is if in WINApi is a function which forces program to make textbox active without I had to click to it?

I tried SetFocus(hEdit); - (hEdit is hwnd of my textbox) - but it does nothing. Is there some another way?

Change of problem - now I used
(IDB_TEXTBOX1 is command of my textbox)
,it is better cause it moves me to textbox,i have cursor here,but when I want to write , it doesn't write. When I post WM_KILLFOCUS then and move to it my mouse click ,then it works ok,but I want to click 'A' and then be able to write.I tried even another last two parameters like 0,1,IDB_TEXTBOX1 and 20 but nothing helps.
Could you tell me how to use this function properly?

...finally I solved the problem but it was pain in ass.If somebody is interested it is

SetFocus(GetDlgItem(hwnd, IDB_TEXTBOX1));
SendDlgItemMessage(hwnd, IDB_TEXTBOX1, EM_SETSEL, 0, -1);

Hello, i would like to ask a question.

How do you get the "command" for your textbox "IDB_TEXTBOX1" ?
What do you mean with "command" ? Because textboxes have no
property like "command" only property like "name" or "id"...

Thank you 4 answering my question.

I just have that textbox like hwnd, not like textbox.

HWND hEdit;


then in winproc:

hEdit = CreateWindowEx(NULL, "EDIT", "", WS_CHILD | WS_VISIBLE | WS_BORDER | ES_MULTILINE, 160,ytextbox,100,38,hwnd,(HMENU)IDB_TEXTBOX1, NULL,NULL);


Oh okay, thank you for your help

it works wonderful ;)

have a nice day!

This question has already been answered. Start a new discussion instead.