初学者问题Shellexecute问题 [英] Beginner Question Shellexecute Problem

查看:73
本文介绍了初学者问题Shellexecute问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,我在Pascal编写了将近3年的乐趣,现在开始使用C ++

现在我遇到了一个问题我无法管理自己,这里是剪辑:



Hello, im coding in Pascal for almost 3 years just 4 fun and started now C++
Now ive got a problem i cant manage myself, here is the snipped:

    TCHAR dir[MAX_PATH] = {0};
SHGetSpecialFolderPathW(NULL, dir, CSIDL_APPDATA, TRUE);


TCHAR *dir2 = lstrcat(dir, TEXT("\Folder"));
TCHAR *app = TEXT ("\Setup.exe");


ShellExecuteW(0,L"open",app,NULL,dir2,0);             // Not Working

MessageBoxW(NULL, dir2,NULL, MB_OK);                  //Working





我正在获取Appdata文件夹,前往/ Folder开始... AppData\Roaming \ File $\\Setup.exe



消息框返回正确的路径但是shellexecute不起作用。谁能指出我正确的方向?谢谢!



Im getting the Appdata folder, heading for the /Folder to start ...AppData\Roaming\Folder\Setup.exe

The messagebox returns the right Path but shellexecute dont work. Can anyone point me in the right direction? thanks!

推荐答案

引用:

不工作


实际上,这不是一个很好的信息。你应该详细说明。



文档 [ ^ ]状态:


Is not a great piece of info, actually. You should elaborate.

The documentation[^] states:

如果功能成功,它返回大于32的值。如果函数失败,则返回一个错误值,指示失败的原因。
If the function succeeds, it returns a value greater than 32. If the function fails, it returns an error value that indicates the cause of the failure.


使用以下内容:



每msdn不支持SHGetSpecialFolderPath。请改用 SHGetFolderPath



Use the following:

per msdn SHGetSpecialFolderPath is not supported. Use SHGetFolderPath instead.

int _tmain(int argc, _TCHAR* argv[])
{
	TCHAR dir[MAX_PATH] = {0};
	SHGetFolderPath(NULL, CSIDL_APPDATA, NULL, 0, dir); 
	TCHAR *dir2 = lstrcat(dir, TEXT("\\Folder"));
	HINSTANCE hReturnCode=ShellExecute(NULL, _T("open"), _T("Setup.exe"), NULL, dir2, SW_SHOWNORMAL);


	return 0;

}


解决问题



似乎是其他问题,因为如果我将应用程序移动到另一台计算机,每个人都可以。我可以忍受这一点。感谢所有试图帮助我的人!
Problem Solved

It seems to be other problem, because if i move the application to another computer, everyone works fine. I can live with that. Thanks to everyone who tried to help me!


这篇关于初学者问题Shellexecute问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆