Home > Software engineering >  CreateProcess StartupInfo change the starting position and size of external program window doesn
CreateProcess StartupInfo change the starting position and size of external program window doesn

Time:09-17

According to the MSDN, as long as you specify the dwX STARTUPINFO, dwY, dwXSize, dwYSize four variables values, then put the
DwFlags=STARTF_USESHOWWINDOW | | STARTF_USESIZE | | STARTF_USEPOSITION such Settings, can be opened for the new application of the position and size, but the results didn't have any effect, trouble, to help the younger brother to see how to solve this problem, thank you,

Specific code is as follows:

PROCESS_INFORMATION PI;
STARTUPINFO si={sizeof (si)};
Si. DwFlags=STARTF_USESHOWWINDOW | | STARTF_USESIZE | | STARTF_USEPOSITION;
Si. WShowWindow=SW_SHOWDEFAULT;
Si. The dwX=0;
Si. DwY=0;
Si. DwXSize=800;
Si. DwYSize=600;

Char szApplicationName []="D: \ \ iQIYI \ \ 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, & amp; Si, & amp; PI);

CodePudding user response:

DwX
Ignored 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 the from the upper left corner of the screen. The processes For GUI, the specified position is, informs 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 the from the upper left corner of the screen. The processes For GUI, the specified position is, informs the first time the new process calls CreateWindow to create an overlapped window if the y parameter of CreateWindow is CW_USEDEFAULT.

CodePudding user response:

Then FindWindow
MoveWindow

CodePudding user response:

reference 1st floor schlafenhamster response:
dwX
Ignored 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 the from the upper left corner of the screen. The processes For GUI, the specified position is, informs 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 the from the upper left corner of the screen. The processes For GUI, the specified position is, informs the first time the new process calls CreateWindow to create an overlapped window if the y parameter of CreateWindow is CW_USEDEFAULT.

Want to ask a question: if you create the form process can specify the location and size, please check the FileName:='C:/Program Files/Borland/Delphi7/Projects/project12 exe' main form parameter Settings, the WindowsState shall be the wsNormal, the Position should be poDefault, how do I view the main form of parameter Settings, where can see WindowsState?

CodePudding user response:

Use or |, rather than logic or | |
Si. DwFlags=STARTF_USESHOWWINDOW | STARTF_USESIZE | STARTF_USEPOSITION;

If not, try Findwindow SetWindowPos

CodePudding user response:

If you want to start the program does not read STARTUPINFO parameters of course will not useful
Can be started after the SetWindowPos to set
  • Related