【发布时间】:2014-04-10 20:50:17
【问题描述】:
我正在寻找一种从当前 Internet Explorer URL 以字符串形式返回 url 的方法。
这种方法使用 dde。它非常快并且运行良好,除了它返回一个非常长的字符串,分为两部分,都带有引号。
uses
ddeman;
function GetURL(Service: string): string;
var
ClDDE: TDDEClientConv;
temp: PAnsiChar;
begin
Result := '';
ClDDE := TDDEClientConv.Create(nil);
with ClDDE do
begin
SetLink(Service, 'WWW_GetWindowInfo');
temp := RequestData('0xFFFFFFFF');
Result := StrPas(temp);
StrDispose(temp);
CloseLink;
end;
ClDDE.Free;
end;
例如,这会返回: "http://core2.staticworld.net/images/article/2014/01/counterfeit_android_apps1-100227383-medium.jpg","http://core2.staticworld.net/images/article/2014/01/counterfeit_android_apps1-100227383-medium.jpg"
但我只在第一个逗号之前寻找不带引号的第一部分: http://core2.staticworld.net/images/article/2014/01/counterfeit_android_apps1-100227383-medium.jpg
对另一种方法或如何解析字符串以生成不带引号且仅显示字符串第一部分的结果有任何建议吗?
【问题讨论】:
-
为什么不能只提取逗号前的部分,然后自己删除引号?
-
我想知道当背景中有多个带有多个标签的ie窗口时,您如何定义当前 url。
-
每当我看到一个逗号分隔的双引号字符串时,我的脑海中就会出现
TStringList.DelimitedText:o)
标签: delphi delphi-xe4