从当前的浏览器取得当前URL
清醒时做事,糊涂时读书,大怒时睡觉,无聊时关注图老师为大家准备的精彩内容。下面为大家推荐从当前的浏览器取得当前URL,无聊中的都看过来。
Unit1.Cpp
//---------------------------------------------------------------------------
#include vcl.h
#pragma hdrstop
#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(Tcomponent* Owner)
: Tform(Owner)
{
}
//---------------------------------------------------------------------------
String TForm1::Get_URL(AnsiString Servicio)
{
TDdeClientConv *Cliente_DDE=new TDdeClientConv(NULL);
char *temp;
Cliente_DDE-SetLink(Servicio,"WWW_GetWindowInfo");
temp=Cliente_DDE-RequestData("0xFFFFFFFF");
Cliente_DDE-CloseLink();
delete Cliente_DDE;
return String(temp);
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(Tobject *Sender)
{
ShowMessage(Get_URL("IeXPlore"));
}
//---------------------------------------------------------------------------
Unit1.H
//---------------------------------------------------------------------------
#ifndef Unit1H
#define Unit1H
//---------------------------------------------------------------------------
#include Classes.hpp
#include Controls.hpp
#include StdCtrls.hpp
#include Forms.hpp
#include "ddeman.hpp"
//---------------------------------------------------------------------------
class TForm1 : public Tform
{
__published: // IDE-managed Components
Tbutton *Button1;
void __fastcall Button1Click(Tobject *Sender);
private: // User declarations
String TForm1::Get_URL(AnsiString Servicio);
public: // User declarations
__fastcall TForm1(Tcomponent* Owner);
};
//---------------------------------------------------------------------------
extern PACKAGE TForm1 *Form1;
//---------------------------------------------------------------------------
#endifright">(出处:清风软件下载学院)