상세 컨텐츠

본문 제목

[윈도우즈 API] IE의 현재 url 가져오기

카테고리 없음

by [롯벨] 2023. 9. 9. 08:15

본문

procedure TForm1.Button3Click(Sender: TObject);
var
  p : Pchar;
  s : string;
begin
  if DDEClientConv1.SetLink('IEXPLORE','WWW_GetWindowInfo') then
  begin
    Label1.Caption := 'Connected';
    if DDEClientConv1.OpenLink then
    begin
      p := (DDEClientConv1.RequestData('0xFFFFFFFF'));
      s := String(p);
      Label2.Caption :=  copy(s,2,pos('","',s)-2); {pick out url from '"www.somewhere.com","title of page",'}
      strdispose(p);
      DDEClientConv1.CloseLink;
    end
    else
      Label2.Caption := 'Openlink Failed';
  end
  else
    Label1.Caption := 'Connect Failed';
end;