createprocess unsichtbar klappt nicht
-
hallo, ich habe folgendes getestet:
int processid = NULL; string m_firefoxPath = "C:\\Program Files (x86)\\Mozilla Firefox"; STARTUPINFO si; PROCESS_INFORMATION pi; ZeroMemory( &si, sizeof(si) ); si.cb = sizeof(si); si.wShowWindow = SW_HIDE; ZeroMemory( &pi, sizeof(pi) ); string m_EXE = m_firefoxPath + "\\firefox.exe"; int hProcess = CreateProcessA( m_EXE.c_str( ), NULL, NULL, NULL, TRUE, CREATE_NEW_CONSOLE, NULL, m_firefoxPath.c_str( ), LPSTARTUPINFOA(&si), &pi ); if( !hProcess ) { cout << "CreateProcess failed" << GetLastError() << endl; return; } else processid = int(pi.dwProcessId); CloseHandle( pi.hProcess ); CloseHandle( pi.hThread ); hProcess = NULL; HWND h = GetTopWindow( 0 ); while ( h ) { DWORD pid; DWORD dwTheardId = GetWindowThreadProcessId( h, NULL ); if ( pid == processid ) { cout << "Found!" << endl; ShowWindow(h,SW_MINIMIZE); UpdateWindow(h); break; } h = GetNextWindow( h , GW_HWNDNEXT); }klappt nur leider nicht

-
Starte es doch auf einem eigenen Desktop

-
Jochen Kalmbach schrieb:
Starte es doch auf einem eigenen Desktop

hä, wie soll ich das jetzt verstehen?
Ich möchte unsichtbar firefox öffnen und dann eine eingabe simulieren.
-
Besser wäre vermutlich noch eine eigene WindowStation zu verwenden...
Also entweder: CreateDesktop oder CreateWindowStation
Und bei CreateProcess dann den Parameter "lpDesktop" von StartupInfo entsprechend füllen...