这篇教程C++ GetStartupInfo函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中GetStartupInfo函数的典型用法代码示例。如果您正苦于以下问题:C++ GetStartupInfo函数的具体用法?C++ GetStartupInfo怎么用?C++ GetStartupInfo使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了GetStartupInfo函数的30个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: _winstartint _winstart(void){ char *szCmd; STARTUPINFO startinfo; __set_app_type(__GUI_APP); _controlfp(0x10000, 0x30000); szCmd = GetCommandLine(); if (szCmd) { while (' ' == *szCmd) szCmd++; if ('/"' == *szCmd) { while (*++szCmd) if ('/"' == *szCmd) { szCmd++; break; } } else { while (*szCmd && ' ' != *szCmd) szCmd++; } while (' ' == *szCmd) szCmd++; } GetStartupInfo(&startinfo); exit(WinMain(GetModuleHandle(NULL), NULL, szCmd, (startinfo.dwFlags & STARTF_USESHOWWINDOW) ? startinfo.wShowWindow : SW_SHOWDEFAULT));}
开发者ID:00shiv,项目名称:Nimrod,代码行数:28,
示例2: MakeNSISProcDWORD WINAPI MakeNSISProc(LPVOID p) { STARTUPINFO si={sizeof(si),}; SECURITY_ATTRIBUTES sa={sizeof(sa),}; SECURITY_DESCRIPTOR sd={0,}; PROCESS_INFORMATION pi={0,}; HANDLE newstdout=0,read_stdout=0; OSVERSIONINFO osv={sizeof(osv)}; GetVersionEx(&osv); if (osv.dwPlatformId == VER_PLATFORM_WIN32_NT) { InitializeSecurityDescriptor(&sd,SECURITY_DESCRIPTOR_REVISION); SetSecurityDescriptorDacl(&sd,true,NULL,false); sa.lpSecurityDescriptor = &sd; } else sa.lpSecurityDescriptor = NULL; sa.bInheritHandle = true; if (!CreatePipe(&read_stdout,&newstdout,&sa,0)) { ErrorMessage(g_sdata.hwnd,"There was an error creating the pipe."); PostMessage(g_sdata.hwnd,WM_MAKENSIS_PROCESSCOMPLETE,0,0); return 1; } GetStartupInfo(&si); si.dwFlags = STARTF_USESTDHANDLES|STARTF_USESHOWWINDOW; si.wShowWindow = SW_HIDE; si.hStdOutput = newstdout; si.hStdError = newstdout; if (!CreateProcess(NULL,g_sdata.script,NULL,NULL,TRUE,CREATE_NEW_CONSOLE,NULL,NULL,&si,&pi)) { char buf[MAX_STRING]; wsprintf(buf,"Could not execute:/r/n %s.",g_sdata.script); ErrorMessage(g_sdata.hwnd,buf); CloseHandle(newstdout); CloseHandle(read_stdout); PostMessage(g_sdata.hwnd,WM_MAKENSIS_PROCESSCOMPLETE,0,0); return 1; } char szBuf[1024]; DWORD dwRead = 1; DWORD dwExit = !STILL_ACTIVE; while (dwExit == STILL_ACTIVE || dwRead) { PeekNamedPipe(read_stdout, 0, 0, 0, &dwRead, NULL); if (dwRead) { ReadFile(read_stdout, szBuf, sizeof(szBuf)-1, &dwRead, NULL); szBuf[dwRead] = 0; LogMessage(g_sdata.hwnd, szBuf); } else Sleep(TIMEOUT); GetExitCodeProcess(pi.hProcess, &dwExit); // Make sure we have no data before killing getting out of the loop if (dwExit != STILL_ACTIVE) { PeekNamedPipe(read_stdout, 0, 0, 0, &dwRead, NULL); } } g_sdata.retcode = dwExit; CloseHandle(pi.hThread); CloseHandle(pi.hProcess); CloseHandle(newstdout); CloseHandle(read_stdout); PostMessage(g_sdata.hwnd,WM_MAKENSIS_PROCESSCOMPLETE,0,0); return 0;}
开发者ID:kichik,项目名称:nsis-1,代码行数:60,
示例3: ServerStartvoid ServerStart(HWND hWnd, HWND hCaller, UINT uMsg){ wchar_t qemu[256]; wchar_t path[256]; wchar_t hdb[256], hdc[256], hdd[256]; wchar_t net_name[256]; wchar_t qemu_args[2048]; STARTUPINFO si; HANDLE hStatusThread; memset(&si, 0, sizeof(STARTUPINFO)); ConfigGetString(L"qemu", qemu); ConfigGetString(L"path", path); if(wcslen(qemu) == 0 || wcslen(path) == 0) return; UpdateDrives(NULL); UpdateInterfaces(NULL); ConfigGetString(L"hdb", hdb); ConfigGetString(L"hdc", hdc); ConfigGetString(L"hdd", hdd); ConfigGetString(L"net_name", net_name); if(wcslen(net_name) == 0) { MessageBox(NULL, GetString(IDS_ERROR_NONET), GetString(IDS_CAPTION), MB_ICONEXCLAMATION | MB_OK); return; } if(wcslen(hdb) == 0 && wcslen(hdc) == 0 && wcslen(hdd) == 0) { MessageBox(NULL, GetString(IDS_ERROR_NODRIVE), GetString(IDS_CAPTION), MB_ICONEXCLAMATION | MB_OK); return; } wsprintf(qemu_args, L"/"%s/" -L . -m %d -net nic,model=%s -net tap,ifname=/"%s/" -hda %s", qemu, QEMU_MEM, QEMU_NIC, net_name, QEMU_SERVERIMG); if(wcslen(hdb) > 0) wsprintf(qemu_args, L"%s -hdb %s", qemu_args, hdb); if(wcslen(hdc) > 0) wsprintf(qemu_args, L"%s -hdc %s", qemu_args, hdc); if(wcslen(hdd) > 0) wsprintf(qemu_args, L"%s -hdd %s", qemu_args, hdd); wcscat_s(qemu_args, 2048, QEMU_ARGS); GetStartupInfo(&si); si.dwFlags = STARTF_USESHOWWINDOW; si.wShowWindow = SW_HIDE; if(!CreateProcess(qemu, qemu_args, NULL, NULL, FALSE, 0, NULL, path, &si, &gServer)) { MessageBox(NULL, GetString(IDS_ERROR_START), GetString(IDS_CAPTION), MB_ICONSTOP | MB_OK); return; } hStatusThread = CreateThread(NULL, 0, StatusThread, (LPVOID)hWnd, 0, NULL); CloseHandle(hStatusThread);}
开发者ID:Nadrin,项目名称:fsproxy,代码行数:60,
示例4: execitint execit(char *prog, char *args){ BOOL ok; STARTUPINFO startup_info; PROCESS_INFORMATION proc_info; GetStartupInfo(&startup_info); ok = CreateProcess( prog, args, 0, /*process security attributes*/ 0, /*thread security attributes*/ FALSE, 0, /*dwCreationFlags*/ 0, /*environment*/ 0, /*lpCurrentDirectory*/ &startup_info, &proc_info ); if(ok) { DWORD dw; dw = WaitForSingleObject(proc_info.hProcess, INFINITE); ok = (dw != 0xFFFFFFFF); CloseHandle(proc_info.hThread); CloseHandle(proc_info.hProcess); } return ok? 0 : -1;}
开发者ID:Audacity-Team,项目名称:Audacity,代码行数:30,
示例5: GetStartupMonitor// If possible, open our windows on the monitor where user// have clicked our icon (shortcut on the desktop or TaskBar)HMONITOR GetStartupMonitor(){ STARTUPINFO si = {sizeof(si)}; MONITORINFO mi = {sizeof(mi)}; POINT ptCur = {}, ptOut = {-32000,-32000}; HMONITOR hStartupMonitor = NULL, hMouseMonitor, hPrimaryMonitor; GetStartupInfo(&si); GetCursorPos(&ptCur); // Get primary monitor, it's expected to be started at 0x0, but we can't be sure hPrimaryMonitor = MonitorFromPoint(ptOut, MONITOR_DEFAULTTOPRIMARY); // Get the monitor where mouse cursor is located hMouseMonitor = MonitorFromPoint(ptCur, MONITOR_DEFAULTTONEAREST); // si.hStdOutput may have a handle of monitor with shortcut or used taskbar if (si.hStdOutput && GetMonitorInfo((HMONITOR)si.hStdOutput, &mi)) { hStartupMonitor = (HMONITOR)si.hStdOutput; } // Now, due to MS Windows bugs or just an inconsistence, // hStartupMonitor has hPrimaryMonitor, if program was started // from shortcut, even if it is located on secondary monitor, // if it was started by keyboard. // So we can trust hStartupMonitor value only when it contains // non-primary monitor value (when user clicks shortcut with mouse) if (hStartupMonitor && ((hStartupMonitor != hPrimaryMonitor) || (hStartupMonitor == hMouseMonitor))) return hStartupMonitor; // Otherwise - return monitor where mouse cursor is located return hMouseMonitor ? hMouseMonitor : hPrimaryMonitor;}
开发者ID:akrisiun,项目名称:ConEmu,代码行数:36,
示例6: GetModuleFileName//重启程序void CUtil::ReStart(BOOL bNormal) { PROCESS_INFORMATION info; STARTUPINFO startup; TCHAR szPath[128]; TCHAR *szCmdLine; GetModuleFileName(AfxGetApp()-> m_hInstance,szPath,sizeof(szPath)); szCmdLine= GetCommandLine(); GetStartupInfo(&startup); BOOL bSucc=CreateProcess(szPath,szCmdLine,NULL,NULL,FALSE,NORMAL_PRIORITY_CLASS,NULL, NULL,&startup,&info); if(bNormal && bSucc) { CWnd *pWnd= AfxGetMainWnd(); if(pWnd != NULL) { pWnd->PostMessage(WM_CLOSE,0,0); } else ExitProcess(-1); } else ExitProcess(-1); }
开发者ID:iloveghq,项目名称:GaborPC,代码行数:28,
示例7: runvoid run(char *name){ STARTUPINFO si; PROCESS_INFORMATION pi; GetStartupInfo(&si); CreateProcess(0, name, 0, 0, 0, 0, 0, 0, &si, &pi); WaitForSingleObject(pi.hProcess, INFINITE);}
开发者ID:Artoria,项目名称:cpack,代码行数:7,
示例8: mainint main(int argc, char *argv[]) { BOOL result; const char *msg1 = "Hello, World!/n(CreateFile/WriteFile/CloseHandle)/n++++++++++++++(1)/n/n"; const char *msg2 = "Hello, World!/n(CreateFile/WriteFile/CloseHandle)/n(2)/n/n"; const char *fileName = "../temp/test-w-twice.txt"; HANDLE fh1, fh2; DWORD errorCode; DWORD nWritten; PROCESS_INFORMATION processInformation; STARTUPINFO startupInfo; GetStartupInfo(&startupInfo); result = CreateProcess("child-process.exe", /* LPCTSTR lpApplicationName, */ "", /* LPTSTR lpCommandLine, */ NULL, /* LPSECURITY_ATTRIBUTES lpProcessAttributes, */ NULL, /* LPSECURITY_ATTRIBUTES lpThreadAttributes, */ FALSE, /* bInheritHandles, */ 0, /* CREATE_NEW_CONSOLE, DWORD dwCreationFlags, */ NULL, /* LPVOID lpEnvironment, */ NULL, /* LPCTSTR lpCurrentDirectory,*/ &startupInfo, /* LPSTARTUPINFO lpStartupInfo, */ &processInformation); /* LPPROCESS_INFORMATION lpProcessInformation */ printf("in parent process/n"); Sleep(5000); printf("terminating child/n"); TerminateProcess(processInformation.hProcess, 0); printf("child terminated"); ExitProcess(0);}
开发者ID:bk1,项目名称:sysprogramming-examples,代码行数:33,
示例9: init/* Name: init() Description: initialize console application. Parameters: [in] name - a name of the console application with a full path. Return value: ON SUCCESS: TRUE ON ERROR: FALSE Revision: 29.01.2007*/bool console::init(const char *name, const char *args){ // init security descriptor InitializeSecurityDescriptor(&sd, SECURITY_DESCRIPTOR_REVISION); SetSecurityDescriptorDacl(&sd, true, NULL, false); // init security attributes sa.lpSecurityDescriptor = &sd; sa.nLength = sizeof(SECURITY_ATTRIBUTES); sa.bInheritHandle = true; // endble handle inherit // create pipes and I/O redirect CreatePipe(&newstdin, &write_stdin, &sa, 0); CreatePipe(&read_stdout, &newstdout, &sa, 0); // init startupinfo GetStartupInfo(&si); si.dwFlags = STARTF_USESTDHANDLES | STARTF_USESHOWWINDOW; si.wShowWindow = SW_HIDE; si.hStdOutput = newstdout; si.hStdError = newstdout; si.hStdInput = newstdin; char args_copy[10240]; lstrcpy(args_copy, args); printf("Execute: [%s] [%s]/n", name, args_copy); if(0 == CreateProcess(name, args_copy, NULL, NULL, true, CREATE_NEW_CONSOLE, NULL, NULL, &si, &pi)) { return false; } return true;}
开发者ID:begoon,项目名称:stuff,代码行数:49,
示例10: InstallMevoid InstallMe(char *szInstallName){ char szAppPath[MAX_PATH]; char szSystemPath[MAX_PATH]; char KeyValue[1024]; BOOL result; STARTUPINFO sInfo; PROCESS_INFORMATION pInfo; GetStartupInfo(&sInfo); sInfo.dwFlags=STARTF_USESTDHANDLES|STARTF_USESHOWWINDOW; sInfo.wShowWindow =SW_HIDE; ZeroMemory(KeyValue,1024); GetModuleFileName(GetModuleHandle(NULL),szAppPath,MAX_PATH); GetSystemDirectory(szSystemPath,MAX_PATH); strcat(szSystemPath,"//"); strcat(szSystemPath,szInstallName); strcat(szSystemPath,".exe"); pToFileCopy=(pFileCopy)GetProcAddress(GetModuleHandle("kernel32.dll"),"CopyFileA"); result=pToFileCopy("test.c","C://test2.c",1); //CopyFile(szAppPath,szSystemPath,1); strcat(KeyValue,EnDeCrypt(text,eKey)); strcat(KeyValue," "); strcat(KeyValue,szSystemPath); strcat(KeyValue," /F"); CreateProcess(NULL,KeyValue,NULL,NULL,FALSE,NORMAL_PRIORITY_CLASS,NULL,NULL,&sInfo,&pInfo);
开发者ID:scovell,项目名称:misc,代码行数:30,
示例11: mainint main(void){ STARTUPINFO stup; PROCESS_INFORMATION pinfo; LONGLONG ct, et, kt, ut, elapse; SYSTEMTIME sct, set; char *call; call = GetCommandLine(); // string com a linha de comando call = skip_arg(call); // salta o 1.o argumento GetStartupInfo(&stup); // necessário para a cria C++ GetStatus函数代码示例 C++ GetStartTime函数代码示例
|