C语言中ShellExecute函数编译出错
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了C语言中ShellExecute函数编译出错相关的知识,希望对你有一定的参考价值。
今天在Visual Stdio 2008中编译一段代码,如下,这是控制台应用程序,使用了WINAPI中的ShellExecute函数,但是编译出错,错误码为” error C2664: “ShellExecuteW”: 不能将参数 2 从“const char [5]”转换为“LPCWSTR”
与指向的类型无关;转换要求 reinterpret_cast、C 样式转换或函数样式转换“第二个参数是”open“,高手能讲讲这是为什么吗?还有,为什么在VS2008中ShellExecute函数变成了”ShellExecuteW“?这有什么区别吗?回答的好还有悬赏分加
#include "stdafx.h"
#include "windows.h"
int _tmain(int argc, _TCHAR* argv[])
ShellExecute(NULL, "open", "iexplorer.exe", " http://www.google.com", NULL, SW_HIDE);
return 0;
delphi中shellExecute的使用
我想通过shellExecute调用执行cmd命令 brcc32 编译资源文件 代码如下:procedure TForm1.Button1Click(Sender: TObject);
var
se:SHELLEXECUTEINFO;
begin
se.cbSize:=SizeOf(SHELLEXECUTEINFO) ;
se.Wnd:=0;
se.lpVerb:='open';
se.lpFile:='c:\windows\system32\cmd.exe';
se.lpParameters:='brcc32 E:\project\Test\my.rc';
se.lpDirectory:=nil;
se.nShow:=SW_SHOWNORMAL;
se.fMask := SEE_MASK_NOCLOSEPROCESS;
se.hInstApp:=0;
ShellExecuteEx(@se);
WaitForSingleObject(se.hProcess,INFINITE);
end;
我想问下哪里错了吗?请高手给出正确的方法 ,谢谢
改为
se.lpParameters:='/c brcc32 E:\project\Test\my.rc'; 参考技术A 使用语句延迟一下看看.
以上是关于C语言中ShellExecute函数编译出错的主要内容,如果未能解决你的问题,请参考以下文章
C语言中怎样实现打印宏?(例如#define BBBBBBB 100000,然后输入为100000的时候打印出BBBBBB。