Evgueni

I found this excellent blog post on how to establish a connection in C# using the connection manager:

http://blogs.msdn.com/anthonywong/archive/2006/03/13/550686.aspx

In that post, the author talks about using the ConnectionInfo structure. One of the parameters of this structure is hWnd pointer that should allow us to receive callbacks from the native code when the connection status changes.

Due to my limited knowledge of native languages, I don't know how to receive callbacks via hWnd in C#. I assume I need to pass the handle of one of my Windows Forms to ConnectionInfo, but I am confused as to what do I do next. How do I accept the callback

Thank you for your help!

Evgueni




Re: .NET Compact Framework How to detect connection changes

Christopher Fairbairn

Hi,

You can use the MessageWindow class within the .NET Compact Framework to create a hidden window which will allow you to listen for and process window messages.

The MessageWindow class has a Hwnd property which provides you the window handle you can pass along to native code to allow the native code to send window messages to your handler.

MSDN has an article which explains this process "How to: use the MessageWindow Class" - http://msdn2.microsoft.com/en-us/library/5143xwd8.aspx

Hope this helps,

Christopher Fairbairn