刚刚在网上找到的信息,感觉很有用收藏一下
原文:http://hi.baidu.com/%C0%B6%C9%AB%D3%F1%C3%D7%B0%F4%D7%D3/blog/item/6d9978fb57d1fe6c034f56bf.html
TAG:windows mobile ppc windows ce 如何 怎样 执行外部程序 调用其他程序 exe ShellExecuteEx用法 LPSHELLEXECUTEINFO初始化 打开文件夹
如题,刚在CSDN mobile论坛见有2个类似的帖子,不熟悉或者不会在mobile中使用ShellExecuteEx ,花了几分钟去看了看这个API,现总结一下:
API:ShellExecuteEx (LPSHELLEXECUTEINFO lpExecInfo )
ShellExecute的功能是运行一个外部程序(或者是打开一个个已注册的文件、打开一个目录、打印一个文件等等)
首先:填充SHELLEXECUTEINFO结构体,然后调用该函数即可,因为和PC上有所不同,所以很多人不知道如何正确填充结SHELLEXECUTEINFO构体。
示例:
1:打开EXE
SHELLEXECUTEINFO lpExecInfo = {0};
lpExecInfo.cbSize = sizeof(SHELLEXECUTEINFO);
lpExecInfo.fMask = SEE_MASK_NOCLOSEPROCESS;
lpExecInfo.lpVerb = L"Open";
lpExecInfo.hwnd = NULL;
lpExecInfo.lpFile = L"calc.exe";
lpExecInfo.lpDirectory = L"\\windows";
lpExecInfo.nShow = SW_SHOW;
lpExecInfo.lpParameters = NULL;
lpExecInfo.hInstApp = NULL;
ShellExecuteEx(&lpExecInfo);
2:打开指定文件夹
SHELLEXECUTEINFO lpExecInfo = {0};
lpExecInfo.cbSize = sizeof(SHELLEXECUTEINFO);
lpExecInfo.fMask = SEE_MASK_NOCLOSEPROCESS;
lpExecInfo.lpVerb = L"Open";
lpExecInfo.hwnd = NULL;
lpExecInfo.lpFile = L"fexplore.exe";
lpExecInfo.lpDirectory = NULL;//L"\\windows";
lpExecInfo.nShow = SW_SHOW;
lpExecInfo.lpParameters = L"\\Windows\\“开始”菜单\\程序";
lpExecInfo.hInstApp = NULL;
ShellExecuteEx(&lpExecInfo);
OK,相信有了示例再结合MSDN应该谁看了都能明白……