/* Test_connexion_internet.wfm Formulaire de démonstration Permet de savoir si la liaison internet est active ou non Ne renvoie pas le type de connection, simplement son état Programmeur : Maurice Abraham 19 juillet 2010 Utilisation : double_click sur le nom du fichier ou DO Test_connexion_internet.wfm Source : http://msdn.microsoft.com/en-us/library/aa384702(VS.85).aspx et ----- Original Message ----- From: "wagner" Newsgroups: dbase.programming Sent: Saturday, July 17, 2010 4:18 PM Subject: Re: GetInternetConnection (Andrew Shimmin) I did not find the beginning of this topic, I hope this example will help. ============== source ? InternetConnected() result = HowInternetConnected() if result = 1 ? "Connected via modem" elseif result = 2 ? "Connected via Lan/Cable" elseif result = 4 ? "Connected via Proxy" elseif result = 64 ? "Connected Configured" else ? "Not Connected" endif function InternetConnected // Are you connected to the internet ? // ? InternetConnected() If type("InternetGetConnectedState")#"FP" Extern cLong ; InternetGetConnectedState; (cLong,cLong) "wininet.dll" endif return HowInternetConnected()>0 function HowInternetConnected local result If type("InternetGetConnectedState")#"FP" Extern cLong ; InternetGetConnectedState; (cLong,cLong) "wininet.dll" endif result = InternetGetConnectedState(0,0) if result = 1 // return "Connected via modem" elseif result = 2 // return "Connected via Lan/Cable" elseif result = 4 // return "Connected via Proxy" elseif result = 64 // return "Connected Configured" endif // return "Not Connected" return result */ ** END HEADER -- do not remove this line // // Generated on 19/07/2010 // parameter bModal local f f = new test_connection_internetForm() if (bModal) f.mdi = false // ensure not MDI f.readModal() else f.open() endif class test_connection_internetForm of FORM with (this) height = 7.6818 left = 61.2857 top = 7.2273 width = 40.0 text = "" endwith this.PUSHBUTTON1 = new PUSHBUTTON(this) with (this.PUSHBUTTON1) onClick = class::PUSHBUTTON1_ONCLICK height = 3.0 left = 8.0 top = 1.0 width = 24.0 text = "La connexion Internet est-elle active ?" endwith this.IMAGE_ROUGE = new IMAGE(this) with (this.IMAGE_ROUGE) visible = false height = 1.8636 left = 8.0 top = 5.0 width = 4.8571 dataSource = "FILENAME :dUFLP:redlight.gif" endwith this.IMAGE_VERTE = new IMAGE(this) with (this.IMAGE_VERTE) visible = false height = 1.8636 left = 8.0 top = 5.0 width = 4.8571 dataSource = "FILENAME :dUFLP:greenlight.gif" endwith this.TX_ETAT = new TEXTLABEL(this) with (this.TX_ETAT) height = 1.0 left = 13.0 top = 5.5 width = 19.0 text = "Etat de la connexion" fontBold = true alignHorizontal = 1 // Center endwith function PUSHBUTTON1_onClick If type("InternetGetConnectedState")#"FP" Extern cLong ; InternetGetConnectedState(cLong,cLong) "wininet.dll" endif result = InternetGetConnectedState(0,0) if result = 1 .OR. result = 2 .OR. result = 4 .OR.result = 64 form.tx_etat.text = " CONNECTEE" form.image_rouge.visible = false form.image_verte.visible = true else form.tx_etat.text = " NON CONNECTEE" form.image_rouge.visible = true form.image_verte.visible = false endif return endclass