Autosensing dial-up internet connection

Started by
3 comments, last by Lanugo 22 years, 4 months ago
Hi, I''m new in here, so I hope this isn''t a very frequently discussed matter (I allow you to stone me if I''m acting lame, of course). I''d like to create a launcher for an app of mine, that should stay still and quiet in the system tray until the user connects to the internet via a dial up connection. Searching through the Win32 API I''ve found some functions to check the connection status, but I''d like my launcher to be noticed without the need for checking the status every now and then. Is there a way to do this thing? Sorry for my poor English. Lanugo of the Wandering Souls
Advertisement
Could you post the names of those functions? I located the MFC CInternet* classes, but I don''t think you''re interested in MFC. If so, I could probably hunt down the Win32 API calls if you gave me a name or two as reference. I think this is an interesting question.

Alos, have you looked into system hooks?

[ GDNet Start Here | GDNet FAQ | MS RTFM | STL | Google ]
Thanks to Kylotan for the idea!
I don''t have the exact name at hand, but I''ve found something like InternetGetConnectdState (the Internet* family, anyway) declared in wininet.h, and I''ve been told I could use functions related to RAS. I still haven''t done any tests, so I don''t know whether the functions I''ve told you are really useful.
I''ve also played a bit around with the system hooks in the past, but I don''t remember anything related to the net in them (my memory is getting corrupted, too many math exams, so I''m prolly wrong).

Sorry for my English again,
Lanugo of the Wandering Souls
check every 10 seconds or so. DONT use system hooks. you will just screw something up down the road. why odnt you want to check every few seconds? afraid of the cpu usage? if you check only once every 3-5 seconds it will not be noticable (how do you think spyware does its thing?) hooks are meant for more complex things that are probally above what your want to do. also hooks can be dangerous if used improperly and can degrade system performance quite easily if used wrong.

so to finish, just check every few seconds. also not everyone uses dialup. what exactly are you trying to create with this launcher? (sounds like somethign the user coudl just run if they want to). anyhoo, WM_TIMER message with a timer will be helpful.
Yeah, of course! I do not have ANY intention of using system hooks for such a thing! I''ve read they are there only for debugging purposes, and furthermore they slow evertything down! (I once had to debug a really poor-written program, and I had to use them... Those have been the worst days of my life! :-).

I don''t like the idea itself of checking for a working connection every now and then, I feel it isn''t good design. However, checking every minute is my current solution, I just wished to know whether a better one existed.

Thank you for you replies,
Lanugo of the Wandering Souls

This topic is closed to new replies.

Advertisement