.NET Compact Framework Sample: Asynch Callbacks

Learn to use the MessageWindow class to support asynchronous functions between managed and unmanaged code.
  • Version:


    File Name:


    Date Published:


    File Size:

    522 KB

      In the .NET Compact Framework newsgroup several people have asked questions about passing delegates to native Win32 DLL's to be used as asynchronous callbacks to P/Invoke back into managed code after an unmanaged function wants to report back to its caller. Unfortunately, passing delegates to unmanaged code is not supported by the .NET Compact Framework. As an alternative, the .NET Compact Framework contains the MessageWindow class. This class can be used to pass Windows messages from unmanaged code to managed code. The functionality of MessageWindow is great if you need to pass Windows messages to a managed control. In certain solutions however, using the MessageWindow class is somewhat artificial and not a true replacement for delegates. With a little extra coding effort it is possible to setup an event handler mechanism that exposes itself to the managed application developer as if true delegates exist to call back from unmanaged code into managed code. In this article we provide you with the details of this mechanism.
  • Supported Operating System

    Windows 2000, Windows 2000 Service Pack 2, Windows 2000 Service Pack 3, Windows 2000 Service Pack 4, Windows NT, Windows Server 2003, Windows XP

      • Visual Studio .NET 2003
      1. Click the Download link to start the download.
      2. Do one of the following:
        • To start the installation immediately, click Open or Run this program from its current location.
        • To copy the download to your computer for installation at a later time, click Save or Save this program to disk.
Site feedback

What category would you like to give web site feedback on?

Rate your level of satisfaction with this web page today: