C ++ CreateProcess STARTF_USEPOSITION不起作用

时间:2019-03-21 08:22:28

标签: c++ windows winapi createprocess

我正在尝试在屏幕的左上角打开一个程序。但是它不使用我传递给函数的信息。我已经尝试过有和没有WaitForSingleObject(processInfo.hProcess, INFINITE);

我的代码:

STARTUPINFO info = { sizeof(info) };
info.dwX = 0;
info.dwY = 0;
info.dwFlags = STARTF_USEPOSITION;
PROCESS_INFORMATION processInfo;
if (CreateProcess("directory", NULL, NULL, NULL, TRUE, 0, NULL, NULL, &info, &processInfo)){
    WaitForSingleObject(processInfo.hProcess, INFINITE);
}

我尝试在有MoveWindow和没有Sleep()的情况下使用STARTUPINFO info = { sizeof(info) }; PROCESS_INFORMATION processInfo; if (CreateProcess("directory", NULL, NULL, NULL, TRUE, 0, NULL, NULL, &info, &processInfo)){ WaitForSingleObject(processInfo.hProcess, INFINITE); } Sleep(20000) HWND window = FindWindow(NULL, TEXT("program")); RECT rect; if (GetWindowRect(window, &rect)) { int windowWidth = rect.right - rect.left; int windowHeight = rect.bottom - rect.top; MoveWindow(window, 0, 0, windowWidth, windowHeight, TRUE); }

npm ERR! code E404
npm ERR! 404 Not Found - GET http://registry.npmjs.org/bluebird
npm ERR! 404
npm ERR! 404  'bluebird@>= 2.3.2 < 3' is not in the npm registry.
npm ERR! 404 Your package name is not valid, because
npm ERR! 404  1. name can only contain URL-friendly characters
npm ERR! 404 It was specified as a dependency of 'rethinkdb'
npm ERR! 404
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\argestajyer\AppData\Roaming\npm-cache\_logs\2019-03-21T08_17_58_104Z-debug.log

0 个答案:

没有答案