1.在vista, Windows?7?下用
::CreateProcess 存在第一次運行權限問題,所以當時采用了ShellExecute
?
CreateProcess可以創建當前進程的子進和,可以繼承當前進程的內核句柄。???
Winexec,ShellExecute可以創建與當前進程不同地址空間的進程??
?
LRESULT OnRepair(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
{
?
?CPath?? pathFile;
?//獲取當前路徑
?::GetModuleFileName(NULL, pathFile.m_strPath.GetBuffer(MAX_PATH * 2), MAX_PATH * 2);
?
?pathFile.m_strPath.ReleaseBuffer();
?pathFile.RemoveFileSpec();
?pathFile.Append(L"setupwiz.exe");
?
?::ShellExecute(NULL,L"open", pathFile.m_strPath, L"install.xml /p", NULL, SW_SHOWNORMAL);
?//關閉窗口
?EndDialog(-1);??
?return 0;
}
posted on 2009-04-12 23:39
-274°C 閱讀(1070)
評論(0) 編輯 收藏 所屬分類:
C++