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'
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'
解决方案 »
- delphi Pchar Dll 的问题
- 大家帮我看看delphi打印出的问题,先谢了!
- 如何安装带有*.dpk的第三方控件
- 求购 delphi2 程序设计大全(Delphi 2 Unleashed)
- 如何判断窗口中密码框
- delphi编写的ActiveX控件,在ie中访问可以但是,在ie中打开本地文件出错,请问如何解决
- 在Delphi中用ADO连接access数据库用ADOQuery的SQL语句如何判断此数据库中有或是没有某个表????
- 关于小区里宽带上网的问题!
- 无事,散分随便问一个问题~~~~~~~~~~
- 请教一些关于发布WEB数据库的问题
- 高手在吗:delphi5在XP下装载DLL文件后就不能单步跟踪调试,在win2000下没有问题.
- TTreeView的ShowLines属性简单问题! 200409
mysyspath:array[0..255] of char;
mypath:string;
begin
getsystemdirectory(mysyspath,255);
mypath:=mysyspath+'\calc.exe';
shellexecute(application.MainForm.Handle,'open',pchar(mypath),nil,nil,sw_normal);
end;
所以不用加system32\calc.exe,
楼主,解决了没有?
391*****mypath:=mysyspath+'\System32\calc.exe';
应该是这样的:
mypath:= PAnsiChar(StrPas(mysyspath) + '\System32\calc.exe');
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;