Getting status information when establishing an async connection
There was an interesting post over in the microsoft.public.smartphone.developer newsgroup today that seemed worth blogging the answer to. The question was:
“[...] can my application receive messages or have a callback called when the status of my asynchronous connection attempt changes?”
The answer is yes. To do this you need to use a couple of members in the CONNMGR_CONNECTIOINFO passed to ConnMgrEstablishConnection(). To get window messages as connection status changes set the hWnd member to the window handle that should receive the messages. Then set the uMsg member to the window message you'd like to have sent (I usually use WM_USER + some offset). Optionally you can set the lParam method to a value you want to have sent along for the ride with the window message.
As connection status changes you'll receive messages to the window you specified, with the wParam set to the status. A list of the supported states can be found in the ConnMgrConnectionStatus() documentation.
[Author: Neil Enns]