| 补充一下: 运行并等待:
 PS:部分使用DDE的程序会导致退出了,但是进程仍然存在,这样会引起本程序无限等待.使用CreateProcess来创建进程并等待效果会好很多,缺点是你得指定exe的完整路径,而不是一个msi....#include <Windows.h>
#pragma comment(linker, "/MERGE:.text=.thesnoW")
#pragma comment(linker, "/MERGE:.rdata=.thesnoW")
int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd )
{
        HMODULE mod=LoadLibrary("shell32.dll");
        DWORD pShellExecute=(DWORD)GetProcAddress(mod,"ShellExecuteExA");
        char x[sizeof(SHELLEXECUTEINFO)];
        LPSHELLEXECUTEINFO lpExecInfo = (LPSHELLEXECUTEINFO)x;
        lpExecInfo->cbSize=sizeof(SHELLEXECUTEINFO);
        lpExecInfo->nShow=nShowCmd;
        lpExecInfo->lpFile="test.msi";
        lpExecInfo->lpParameters="/passive";
        lpExecInfo->fMask=SEE_MASK_NOCLOSEPROCESS ;
        __asm{
                push lpExecInfo;
                call dword ptr pShellExecute;
        }
        WaitForSingleObject(lpExecInfo->hProcess,INFINITE);
        CloseHandle(lpExecInfo->hProcess);
        ExitProcess(0);
}
 
 
 |