首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > VC/MFC >

使用ShellExecute函数出错解决方法

2012-06-03 
使用ShellExecute函数出错C/C++ codechar fName[FILENAME_MAX]GetModuleFileName(NULL, fName, FILENAME_

使用ShellExecute函数出错

C/C++ code
char fName[FILENAME_MAX];    GetModuleFileName(NULL, fName, FILENAME_MAX);    *strrchr(fName, '\\') = '\0';    *strrchr(fName, '\\') = '\0';    *strrchr(fName, '\\') = '\0';    strcat(fName, "\\CenterDemo\\Debug\\CenterDemo.exe");    ShellExecute(this->m_hWnd,"open",fName,"","", SW_SHOW );


文件路径什么的都是对的,手动点击那个exe也行,为啥这个启动不起来呢?那个地方不对啊?

[解决办法]
ShellExecute(this->m_hWnd,"open",fName,NULL,NULL, SW_SHOW );



[解决办法]
最后一个参数,建议使用SW_SHOWNORMAL

[解决办法]
你调试一下看看fName的值正确?ShellExecute函数的返回值是什么?
[解决办法]
这要你的路径获取正确用这句就可以了
ShellExecute(NULL,_T("open"),path,NULL,NULL,SW_SHOW);
[解决办法]
探讨
怎么没人关注一下呢?这个exe启动后立马就关闭了啊?其中这个exe是需要调用其工作目录中的init.cfg文件,难道是这个原因????大神们,给点帮助呗

热点排行