在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs; type TSysChatMainForm = class(TForm) procedure FormCreate(Sender: TObject); procedure FormDestroy(Sender: TObject); private { Private declarations } FTestNetThread: TThread; public { Public declarations } end; var SysChatMainForm: TSysChatMainForm; implementation {$R *.dfm} type TTestNetThread = class(TTHread) procedure Execute; override; procedure RefreshUIInMainThread; end; { TTestNetThread } procedure TTestNetThread.RefreshUIInMainThread; begin bsTrayIcon.ShowBalloonHint('网络异常','由于网络异常,程序掉线!',bsbitInfo); end; procedure TTestNetThread.Execute; begin inherited; FreeOnTerminate := True; while (not Terminated) and (not InternetGetConnectedState(nil, 0)) then begin Data.UserOff('[脱机]',false); Synchronize(RefreshUIInMainThread); Sleep(3000) end; end; { TSysChatMainForm } procedure TSysChatMainForm.FormCreate(Sender: TObject); begin FTestNetThread := TTestNetThread.Create(False); end; procedure TSysChatMainForm.FormDestroy(Sender: TObject); begin FTestNetThread.Terminate; end; end.
|
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论