<b>从当前的浏览器获得当前URL</b>[VC/C++编程]
本文“<b>从当前的浏览器获得当前URL</b>[VC/C++编程]”是由七道奇为您精心收集,来源于网络转载,文章版权归文章作者所有,本站不对其观点以及内容做任何评价,请读者自行判断,以下是其具体内容:
看了一篇同名的文章,是用Delphi写的.试了今后效果还行,主如果操纵了TDdeClientConv,于是改成CB版的贴出来.蓝色字符为手动增添的.
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;
//---------------------------------------------------------------------------
#endif
以上是“<b>从当前的浏览器获得当前URL</b>[VC/C++编程]”的内容,如果你对以上该文章内容感兴趣,你可以看看七道奇为您推荐以下文章:
本文地址: | 与您的QQ/BBS好友分享! |