Original Post
Hello! I'm trying to send a message between two windows, basicly I just have a input waiting in the other window using "cin" and I want another program to make that input. The name of the program is named "GetMessageApp". after some reading I understood that I need the "handle" for this DOS window and I dont really know how to get it. I understand that this is easy in the "Graphical" programs but when you are using DOS windows its a bit harder. This is my little program called GetMessageApp.exe
#include <iostream>
#include <string>
using namespace std;
int main() {
string msg;
cout << "Wating for message.." <<endl;
cin >> msg;
cout << msg <<endl;
system("PAUSE");
return 0;
}
And this is my "not really finished other Dos program" :)
#include <windows.h>
#include <stdio.h>
#include <iostream>
using namespace std;
#pragma comment(lib, "User32.lib")
void Send() {
HWND GetMessageApp;
HWND result;
result = FindWindowEx(GetMessageApp,NULL,NULL,NULL);
SendMessage(GetMessageApp,WM_KEYDOWN,NULL,NULL);
}
int main(void)
{
Send();
cout << "Message sent" <<endl;
return 0;
}
As you see I'm not really familiar with WinAPI and its functions so I thought maybe anyone want to help me out a bit in finding the handler for my first program so I will able to perform this maybe pretty easy task :) Thanks in advance! / David