[英]c++ calling ShellExecute without specifying path
i got a file name that is predefined as a string. 我得到了预定义为字符串的文件名。 can i call shellexcute without specifying the full path? 我可以在不指定完整路径的情况下调用shellexcute吗? like: 喜欢:
ShellExecute(NULL, L"open", PreDefiendFileName, NULL, NULL, 0);
what should i do otherwise if not? 如果没有,我该怎么办?
You could: 你可以:
I'd encourage you to think defensively about this problem. 我鼓励您对这个问题采取防御性的思考。 Eg ensure that the file name that is passed is actually a file ("does it have the correct extension?", "does it exist in the file system?") and then only call the ShellExecute
function if those checks pass. 例如,确保传递的文件名实际上是一个文件(“扩展名正确吗?”,“文件系统中是否存在?”), 然后仅在这些检查通过的情况下才调用ShellExecute
函数。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.