delphi中edit给字符串变量赋值问题

2025-03-05 05:30:11
推荐回答(3个)
回答1:

很简单啊!
var
a:string;
b:string;
c:string;
begin
Edit1.Text := '';
a:= 'http://www.baidu.com';
b:=Edit1.Text;
c:= a + b;
ShellExecute(Handle,'open','Explorer.exe',PChar(c),nil,SW_SHOWNORMAL);//需要引用ShellAPI
end;

已经在Delphi上测试过了,OK!

回答2:

a的赋值语句后面没分号;
ShellExecute的第四个参数要转换成PChar
ShellExecute(Handle,'open','Explorer.exe',PChar(c),nil,SW_SHOWNORMAL);

回答3:

a:= 'http://www.baidu.com' 后边有个分号 ;

再有就是从网上复制下来的代码,是否有特别字符呢?
有些空格的地方其实就是特殊字符。