Why wont this work

CWnd *cwnd = FindWindow(NULL,"Setup - Spybot - Search & Destroy");
cwnd->SendMessage(WM_KEYDOWN,VK_RETURN,0);
I'm trying to send that the enter key was pressed to another app but it dosent work.
[220 byte] By [immortal20] at [2007-11-18 17:38:52]
# 1 Re: Why wont this work
The WM_KEYDOWN message is a notification message. You can't send a window a notification message and expect that to have the same effect as the event to which the notification message heralds....

In other words the concept of sending a window a WM_KEYDOWN message in order to symulate a keystroke is a faulty one.
JMS at 2007-11-11 1:26:19 >
# 2 Re: Why wont this work
What is the right way to do it
immortal20 at 2007-11-11 1:27:22 >
# 3 Re: Why wont this work
Not to leave you without an alternative solution here are some alternatives you can try...

SendInput (WinNT/2000/XP)

or.

VkKeyScan()

good luck..
JMS at 2007-11-11 1:28:21 >
# 4 Re: Why wont this work
How do you use SendInput because it's saying its a undeclared identifier?
immortal20 at 2007-11-11 1:29:26 >