V
ich hab mal versucht mit MS Spy++ eine Konsole auszuspionieren
"The specified window cannnot be spied upon. Windows will not allow access to the message stream for this window"
mein Gedanke war per Get/SetMessage einfach den Textbuffer in der Konsole auszulesen - anscheinend funktioniert das nicht
um z. B. die Titelleiste des MS Inet Expolorer auszulesen kann man diesen Code verwenden (hab ich hier mal im Forum gefunden)
#include <iostream>
using namespace std;
#include <string>
#include <windows.h>
void GetURL(char *titel)
{
//char * titel = "\1:blank - Microsoft Internet Explorer";
char buffer[1256];
HWND child;
HWND ie;
if(ie = ::FindWindow("IEFrame",titel))
{
if(child = ::FindWindowEx(ie,0,"WorkerW",0))
{
if(child = ::FindWindowEx(child,0,"ReBarWindow32",0))
{
if(child = ::FindWindowEx(child,0,"ComboBoxEx32",0))
{
::SendMessage(child,WM_GETTEXT,255,(long)&buffer[0]);
char * tmp = &buffer[0];
//AfxMessageBox(tmp);
cout<<tmp<<endl;
}
}
}
}
}
//Quellcode
BOOL CALLBACK EnumWindowsProc(HWND hwnd, LPARAM lParam)
{
static char cbuff[256]="\0";
static char strClass[200];
static DWORD dwPID=0;
// get window class name
::GetClassName(hwnd, strClass, 200);
// get pid
::GetWindowThreadProcessId(hwnd, &dwPID);
// get caption
::GetWindowText(hwnd, cbuff, sizeof(cbuff));
//cout<<cbuff<<endl;
// buff.Format("%s",cbuff);
// In buff stehen nun alle offnen Fenster drin
// Du musst nun einfach die Rausfiltern die MIE oder halt Opera
// Im Titel haben
// mit if und find arbeiten
GetURL(cbuff);
return true;
}
int main()
{
// Der Aufruf der Callback Funktion
EnumChildWindows(GetDesktopWindow(),EnumWindowsProc, NULL);
system("pause");
}
wäre schon, wenn jemand eine möglichkeit findet das Konsolenfenster zu lesnen bzw. zu schreiben...