📄 unit1.pas
字号:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls,wininet;
type
TForm1 = class(TForm)
Button1: TButton;
Edit1: TEdit;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
const
INTERNET_CONNECTION_MODEM = 1; // 通过modem连接上网
INTERNET_CONNECTION_LAN = 2; // 通过局域网连接上网
INTERNET_CONNECTION_PROXY = 4; // 通过代理连接上网
INTERNET_CONNECTION_MODEM_BUSY = 8; // modem忙,未能连接上网
procedure TForm1.Button1Click(Sender: TObject);
var
dwConnectionTypes: DWORD;
Is_connected:Bool;
begin
dwConnectionTypes := INTERNET_CONNECTION_MODEM+ INTERNET_CONNECTION_LAN+ INTERNET_CONNECTION_PROXY;
Is_connected :=InternetGetConnectedState(@dwConnectionTypes, 0);
if Is_connected then
begin
if (dwConnectionTypes and INTERNET_CONNECTION_MODEM) = INTERNET_CONNECTION_MODEM then
edit1.Text:='通过Modem连接上网';
if (dwConnectionTypes and INTERNET_CONNECTION_LAN) = INTERNET_CONNECTION_LAN then
edit1.Text:='通过局域网连接上网';
if (dwConnectionTypes and INTERNET_CONNECTION_PROXY) = INTERNET_CONNECTION_PROXY then
edit1.Text:='通过代理连接上网';
end;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -