Take the address of your business network IP

xiaoxiao2021-03-06  35

Unit Unitip;

Interface

uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, IdBaseComponent, IdComponent, IdTCPConnection, IdTCPClient, IdHTTP, XPMan, StdCtrls, Buttons, ExtCtrls, WinInet;

{================================================================================================================================================================================================================ ====== Design By: Flower Month / Jade Side: http://www.eaStrise.cn/quick2004 blog: http://blog.9cbs.net/jackie168 email: Joe -lu@163.com

The article is the author original. Please contact him before reprinting, reprint, please indicate the article, retain the author information, thank you for your support! ============================================================================================================================================================================================================= =====}

type TForm1 = class (TForm) Panel1: TPanel; BitBtn1: TBitBtn; XPManifest1: TXPManifest; IdHTTP1: TIdHTTP; procedure BitBtn1Click (Sender: TObject); procedure FormCreate (Sender: TObject); private {Private declarations} public {Public declarations} end ;

Var Form1: TFORM1;

IMPLEMentation

{$ R * .dfm} function extractstr (str: string): string; // format string var I, J: Integer; begin result: = '; J: = Length (STR); for i: = 0 To J Dobeginif STR [I] in ['0' .. '9', '.'] Theresult: = Result Str [I]; end;

Function isinternet: boolean; / / Check if connected to network begin if Internetcheckconnection ('http://www.eastrise.cn/ip.asp', 1, 0) Then Result: = true else result: = false; end; procedure TFORM1.BITBTN1CLICK (Sender: TOBJECT); Begin if IsInterNet The Begin Panel1.caption: = 'Your Public Network IP:' Extractstr (IDHTTP1.Get ('http://www.eastrise.cn/ip.asp') ); // Take the IP address ELSE Application.MessageBox ('The machine is not connected to the network or server error!', 'Error', MB_OK MB_ICONERROR);

Procedure TForm1.FormCreate (Sender: TOBJECT); Begin Panel1.caption: = '; // Initialization End;

End.

转载请注明原文地址:https://www.9cbs.com/read-63771.html

New Post(0)