2
我試圖在隱藏的桌面上啓動應用程序,但沒有得到太多的進展,找不到有關桌面和窗口站點的真實情況的詳細文檔。這裏是我的錯誤處理代碼刪除(但beleive我它的存在,而不是捕捉任何錯誤):窗口工作站和桌面
HWINSTA winSta = CreateWindowStation(_T("hiddenWinSta"), 0, 0, NULL);
SetProcessWindowStation(winSta);
HDESK desktop = CreateDesktop(_T("hiddenDesktop"), NULL, NULL, 0, DESKTOP_CREATEWINDOW, NULL);
OpenDesktop(_T("hiddenDesktop"), 0, TRUE, GENERIC_ALL);
SetThreadDesktop(desktop)
HWINSTA r = GetProcessWindowStation();
printf("winsta: %x %x\n", r, winSta);
HDESK curdesk = GetThreadDesktop(GetCurrentThreadId());
printf("desktop: %x %x\n", curdesk, desktop);
STARTUPINFO si;
PROCESS_INFORMATION pi;
ZeroMemory(&si, sizeof(si));
si.cb = sizeof(si);
//si.lpDesktop = _T("hiddenDesktop");
ZeroMemory(&pi, sizeof(pi));
TCHAR szCommand[MAX_PATH];
_sntprintf_s(szCommand, MAX_PATH, _T("%s"), _T("c:\\windows\\system32\\calc.exe"));
DWORD res = CreateProcess(NULL, szCommand, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi);
如果我取消了si.lpDesktop線中未能啓動可怕的錯誤0x000142。如果我評論si.lpDesktop進程在當前桌面上啓動。 我在做什麼錯?是否有可能做我想做的事(即啓動一個完全不可見的Windows GUI應用程序)?
什麼是不可見的桌面上推出* Windows圖形用戶界面*應用程序的地步? GUI是「圖形用戶界面」,意味着它期望從用戶獲取信息或向用戶顯示信息。 –
嘗試取消註釋'si.lpDesktop = _T(「hiddenDesktop」);'和註釋'HWINSTA winSta = CreateWindowStation(_T(「hiddenWinSta」),0,0,NULL);''SetProcessWindowStation(winSta);' – sergmat
@Ken White自動化 –