类型:转载 责任编辑:asp.net 日期:2007/05/23
热门软件下载:
var
mysyspath:pchar;
mypath:pchar;
begin
getsystemdirectory(mysyspath,255);
391*****mypath:=mysyspath+\System32\calc.exe;
shellexecute(application.MainForm.Handle,open,pchar(mypath),nil,nil,sw_normal);
end;
[Error] Unit1.pas(391): Incompatible types: String and PAnsiChar
网友回答:
//这是我的函数库的一个函数或许对你有帮助
Function GetSystemDir: AnsiString;
var
lpStr: PAnsiChar;
lpnLength:integer;
begin
Result:=;
lpnLength:=GetSystemDirectory(nil,0); // 取得字串长度
if lpnLength > 0 then
begin
GetMem(lpStr,lpnLength);
if GetSystemDirectory(lpStr,lpnLength)>0 then
Result := lpStr;
FreeMem(lpStr,lpnLength);
end;
end;{ GetSystemDir} //返回当前Windows系统System32目录的路径名(如:C:\Windows\System32)
//下面是你要调用的这个函数代码
var
mypath:String;
begin
mypath:=GetSystemDir+\calc.exe;
shellexecute(application.MainForm.Handle,open,pchar(mypath),nil,nil,sw_normal);
end;