views:

440

answers:

2

Hi All,

I have a data card, as soon as i insert the data card, i am getting the events by using wm_device_change event.

But I also want to get event, when my data connect actually connects to out side world.

I mean to say, as soon as we click on connect/disconnect button of data card,i want to get the event.

exactly speaking wanted to know, when connection is established and disconnected.

data card is vodaphone data card and i am trying to browse using that data card. what ever is the SDK, somewhere the OS should get the event of connection and disconnection to network is there any way to access that event which OS is getting. as i can see in notificaiton the changes of vodaphone connection and LAN connection

data card is a USB device having SIM within it, and can be used to access internet through GPRS.

can i know how to do this in win32 c/c++ programe.

with regards Vinayaka Karjigi

A: 

Surely this would depend on your "Data Card" sdk or drivers and whether they support such an event.

Otherwise what I would suggest is that when you call the "Connect" or "Disconnect" methods within the SDK that you use any return value indicating suuccess or otherwise to raise your own event.

Without knowing what this data card is and what it is connecting to then I don't see how we can answer your question more fully.

ChrisBD
data card is vodaphone data card and i am trying to browse using that data card.what ever is the SDK, somewhere the OS should get the event of connection and disconnection to networkis there any way to access that event which OS is getting.as i can see in notificaiton the changes of vodaphone connection and LAN connection,
Vinayaka Karjigi
Please add that to your original post. Note that Vodafone is a telecom provider, so this is likely a "network card".
MSalters
A: 

To detect a network change, you can use NotifyAddrChange(0,0); Since this is blocking, you will need a thread. The thread funtion can be as simple as

while(true) {
  NotifyAddrChange(0,0);
  PostMessage(gHWnd, WM_APP,0,0);
}

Don't bother with the documented asynchronous behavior. That simply doesn't work.

MSalters