Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Whats SendKeys of VB in C++

Status
Not open for further replies.

chaitu

Programmer
May 30, 2002
17
MO
Hi,

Any idea whats the alternative of SendKeys method of VB in C++/VC++.
SendKeys of VB sends key strokes to any application specified, as if entered from the keyboard.

Tried WinExec() & OpenProcess() to get a handle, but this handle cannot be used in SendMessage().

All I want is, through my application, I need to opeon windows explorer and senesome key strokes to it.

Thanks in adv,
Chaitu
 
You can send message only to windows. Try to get the handle to window where do you want to send messages. Also you could send thread messages SendThreadMessage. John Fill
1c.bmp


ivfmd@mail.md
 
To get a handle of the window you can use:

EnumThreadWindows:):GetCurrentThreadId(VOID),
(WNDPROC)MyCallbackProc,0);

BOOL CALLBACK MyCallbackProc(
HWND hwnd, // handle to window
LPARAM lParam // application-defined value
);

inside MyCallbackProc you will receive the hwnd you want. then you can use SendMessage on this hwnd.

Hope this helps,

s-)

Blessed is he who in the name of justice and good will, shepards the week through the valley of darknees...
 
How can click on "Cancel" button of one window(there are three buttons) in another application by using VC++ or API. I can get window handle. But how can I send "ENTER" message to "Cancel" button. It is not focus yet. Please provide simple code.

John Chne
 
How can click on "Cancel" button of one window(there are three buttons) in another application by using VC++ or API. I can get window handle. But how can I send "ENTER" message to "Cancel" button. It is not focus yet. Please provide simple code.

John Chne
 
jijo2q -

As far as I know, this is not possible under Windows 2000 and Windows XP, as Microsoft tightened the permissions for doing this. Maybe someone else here knows how to do it?

Chip H.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top