internet connection status
BlitzPlus Forums/BlitzPlus Programming/internet connection status
| ||
Is there a way within blitzplus to determine whether or not my computer is connected to the internet. As in START - Connect To - Show All Connections - which shows your internet access status (connected/disconnected). Thanks. TimJo. |
| ||
Read a pixel from the desktop if you have a online icon. |
| ||
I think I know what you're getting at, Nebula, but how would you know whereabouts to read the pixel on the desktop ? Clever solution though. |
| ||
Not too clever, if the icon is shown in the system tray (which it should), it can be in a different location every time. |
| ||
http://msdn2.microsoft.com/en-us/library/ms647415.aspx |
| ||
That's not too big a problem - as I can scan across the system tray - the problem is that if the mouse pointer is over the icon when I check for it's existance it can mess things up. Is there a way to temporarily hide the pointer when over the desktop/system tray - as I check ? - the hide/showpointer commands only work with canvases. |
| ||
Hmm... after a quick re-check - the mouse pointer doesn't seem to affect this after all. (I expect the more technically aware of you out there know why it doesn't seem to register with a readpixel command - maybe a sprite or something - I don't know). |
| ||
Create a file called "url.decls" in your blitzplus\userlibs folder (by default: C:\Program Files\BlitzPlus\userlibs), copy and paste the following....lib "url.dll" InetIsOffline%(dwFlags%) Save the file and go into your IDE, test the following code.. Notify InetIsOffline%(0) If it returns 0, that means your connected to the internet, if it returns 1 that means your not connected. |
| ||
Hm... Any ideas on how to call that one from BlitzMax? |
| ||
So far I've got thisSuperStrict Extern "win32" Function LoadLibrary:Int(name$z) = "LoadLibraryA@4" Function GetProcAddress:Byte Ptr ( Library:Int , Name$z ) EndExtern Local urld:Int = LoadLibrary( "C:\WINDOWS\system32\url.dll" ) Local InetIsOffline:Int(dwflags:Int) = GetProcAddress ( urld , "InetIsOffline" ) Notify InetIsOffline:Int(0) Connected or not, it will always return 0, dunno what I did wrong here.. |
| ||
I tried the 'url.decls' thing in BlitzPlus - but it gave me '0' whether connected on not connected. |
| ||
How is he supposed to call a command from a dll that doesn't exist? Won't he need to copy the C:\windows\system32\url.dll to his blitzplus userlib directory first? |
| ||
Plash: That's pretty much exactly what I tried as well, with the same results. :-? |
| ||
Returns TRUE if the local system is not currently connected to the Internet. Returns FALSE if the local system is connected to the Internet or if no attempt has yet been made to connect to the Internet. I got this from msdn, I'm not sure what exactly the last line means, but it could be your problem. |
| ||
Oksy, how about thistcp=opentcpstream("www.google.com",80) if not tcp then notify "NOT CONNECTED!" |
| ||
Alaric, That last part, "if no attempt has yet been made to connect to the Internet," basically means that if the computer hasn't checked to see if it's still connected, and it's not, it's going to tell you that it's still connected to the internet |