VC open a exe programme

FROM:http://blogs.msdn.com/oldnewthing/archive/2004/11/26/270710.aspx

// test.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include <windows.h>
#include <shellapi.h>

int main(int argc, char* argv[])
{

    SHELLEXECUTEINFO shell = { sizeof(shell) };
    shell.fMask = SEE_MASK_FLAG_DDEWAIT;
    shell.lpVerb = "open";
    shell.lpFile = "C:\\windows\\NOTEPAD.EXE";
    shell.nShow = SW_SHOWNORMAL;
    BOOL ret = ShellExecuteEx(&shell);

    //"";
    printf("Hello World!\n%d",ret);
    getchar();
    return 0;
}

你可能感兴趣的:(open)