按照MSDN中的說法,只要指定STARTUPINFO中的dwX,dwY,dwXSize,dwYSize四個變數的值,然后將
dwFlags = STARTF_USESHOWWINDOW || STARTF_USESIZE || STARTF_USEPOSITION進行如此設定,即可為新打開的應用程式的位置與大小。但是運行結果并沒有起到任何作用,麻煩各位大佬幫小弟看看這個問題怎么解決,謝謝。
具體代碼如下:
PROCESS_INFORMATION pi;
STARTUPINFO si = { sizeof(si) };
si.dwFlags = STARTF_USESHOWWINDOW || STARTF_USESIZE || STARTF_USEPOSITION;
si.wShowWindow = SW_SHOWDEFAULT;
si.dwX = 0;
si.dwY = 0;
si.dwXSize = 800;
si.dwYSize = 600;
char szApplicationName[] = "D:\\愛奇藝\\IQIYI Video\\LStyle\\6.7.82.6548\\QyClient.exe";
char szCommandLine[] = "QyClient.exe";
BOOL bRet = CreateProcess(szApplicationName, szCommandLine, NULL, NULL, FALSE, CREATE_NEW_CONSOLE, NULL, NULL, &si, &pi);
uj5u.com熱心網友回復:
dwXIgnored unless dwFlags specifies STARTF_USEPOSITION. Specifies the x offset, in pixels, of the upper left corner of a window if a new window is created. The offset is from the upper left corner of the screen. For GUI processes, the specified position is used the first time the new process calls CreateWindow to create an overlapped window if the x parameter of CreateWindow is CW_USEDEFAULT.
dwY
Ignored unless dwFlags specifies STARTF_USEPOSITION. Specifies the y offset, in pixels, of the upper left corner of a window if a new window is created. The offset is from the upper left corner of the screen. For GUI processes, the specified position is used the first time the new process calls CreateWindow to create an overlapped window if the y parameter of CreateWindow is CW_USEDEFAULT.
uj5u.com熱心網友回復:
再 FindWindowMoveWindow
uj5u.com熱心網友回復:
想請教一個問題: 如果創建的行程不能指定位置和表單大小,請檢查 FileName:='C:/Program Files/Borland/Delphi7/Projects/project12.exe'主表單的引數設定,其WindowsState應為wsNormal,Position應該為poDefault, 請問如何查看主表單的引數設定,在哪里能看到WindowsState呢?
uj5u.com熱心網友回復:
用位或|, 而不是邏輯或 ||si.dwFlags = STARTF_USESHOWWINDOW | STARTF_USESIZE | STARTF_USEPOSITION;
如果不行 就試試 Findwindow SetWindowPos
uj5u.com熱心網友回復:
如果要啟動的程式不讀取STARTUPINFO引數當然就不會有用可以啟動后用SetWindowPos來設定
轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/45357.html
標籤:進程/線程/DLL
上一篇:WinHttpSendRequest在win7下回傳12029錯誤碼。
下一篇:怎么寫一個模擬鍵盤函式
