程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> C語言 >> C >> C語言基礎知識 >> 從當前的浏覽器取得當前URL

從當前的浏覽器取得當前URL

編輯:C語言基礎知識
  我在www.playicq.com看了一篇同名的文章,是用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 right">(出處:清風軟件下載學院)
 
  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved