I want to have a VB6 program open an app, then send a keystroke (enter) to the app. The app may or may not be in focus. I thought if I use SendMessage as shown below, this would work whether or not the app window is in focus...

SendMessage (Hwnd,WM_CHAR,13,ByVal 0)

I have two problems... first, I don't know what declarations need to be made for SendMessage. Last of all, I don't know how to get the Hwnd when I launch the app. I thought maybe it would be like this...

Hwnd = Shell("c:\Programs\MyApp.exe", vbNormalFocus)

I know this isn't correct, but I don't know how to do it. Any help would be appreciated!