CreateProcess的使用,该怎么处理
CreateProcess的使用
CreateProcess能否启动一个MFC(有窗口)的进程并把启动后的进程放到相应的坐标中去?
高手指点~
------解决方案--------------------
不是进程坐标,是可以指定该进程创建的第一个窗口的坐标。
你那段代码应该可以的,不过dwXSize dwYSize不是坐标而是宽度和高度
------解决方案--------------------
可以的,另外那个不是坐标吧,应该是启动时在桌面上的位置。
------解决方案--------------------
dwX
If dwFlags specifies STARTF_USEPOSITION, this member is the x offset of the upper left corner of a window if a new window is created, in pixels. Otherwise, this member is ignored.
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
If dwFlags specifies STARTF_USEPOSITION, this member is the y offset of the upper left corner of a window if a new window is created, in pixels. Otherwise, this member is ignored.
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.
那个程序完全可以不理会你的这些设置
------解决方案--------------------
CreateProcess能否启动一个MFC(有窗口)的进程并把启动后的进程放到相应的坐标中去?
- C/C++ code
STARTUPINFO startInfo; ZeroMemory((PVOID)&startInfo, sizeof(startInfo)); startInfo.cb = sizeof(startInfo); startInfo.lpReserved = NULL; startInfo.lpDesktop = L"default"; startInfo.dwX = 800;//新的坐标 startInfo.dwY = 0;//新的坐标 startInfo.dwXSize = 1024;//新的坐标 startInfo.dwYSize = 768;//新的坐标 startInfo.cbReserved2 = 0; startInfo.lpReserved2 = NULL; startInfo.wShowWindow = TRUE;//此成员设为TRUE的话则显示新建进程的主窗口 startInfo.dwFlags = STARTF_USESIZE | STARTF_USEPOSITION | STARTF_RUNFULLSCREEN | STARTF_USESHOWWINDOW | STARTF_USEFILLATTRIBUTE; WCHAR cmd[16]=L"aaa\\bbb.exe"; bRet = CreateProcess(NULL, // image name cmd, // command line NULL, // process security attributes NULL, // thread security attributes TRUE, // inherit handles CREATE_DEFAULT_ERROR_MODE|CREATE_SEPARATE_WOW_VDM,//dwCreationFlags NULL, // environment block NULL, // current directory &startInfo, // STARTUPINFO &processInfo); // PROCESS_INFORMATION
高手指点~
------解决方案--------------------
不是进程坐标,是可以指定该进程创建的第一个窗口的坐标。
你那段代码应该可以的,不过dwXSize dwYSize不是坐标而是宽度和高度
------解决方案--------------------
可以的,另外那个不是坐标吧,应该是启动时在桌面上的位置。
------解决方案--------------------
dwX
If dwFlags specifies STARTF_USEPOSITION, this member is the x offset of the upper left corner of a window if a new window is created, in pixels. Otherwise, this member is ignored.
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
If dwFlags specifies STARTF_USEPOSITION, this member is the y offset of the upper left corner of a window if a new window is created, in pixels. Otherwise, this member is ignored.
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.
那个程序完全可以不理会你的这些设置
------解决方案--------------------