窗口是基于线程的,即窗口消息只发送到创建该窗口的线程的消息队列。
要接受来自非模态对话框发来到消息,动态链接库中的函数必须在创建
该窗口的线程中运行。
可以在DLL中通过创建一个用户接口线程实现。

解决方案 »

  1.   

    写一个轮廓myfunc()
    {
    CreateThread(,,myui,..);
    }
    myui()
    {
    hDlgModeless = CreateDialog (hInstance, "Dlg", hwnd,Dlgfunc) ;
    while (GetMessage (&msg, NULL, 0, 0))
    {
     if (hDlgModeless == 0 || !IsDialogMessage (hDlgModeless, &msg))
     {
       TranslateMessage (&msg) ;
       DispatchMessage  (&msg) ;
      }
    }
    }
    INT_PTR CALLBACK Dlgfunc(
      HWND hwndDlg,  // handle to dialog box
      UINT uMsg,     // message
      WPARAM wParam, // first message parameter
      LPARAM lParam  // second message parameter
    )
    {switch uMsg
    {
    case WM_PAINT:
    case WM_CHAR:
    }
    return 0;
    }