title: Creating and Loading DialogBox from DLL
body: <p>I've created a dialog box inside a Win32 DLL (using resource editor) and now want to show it as application program (using this DLL) calls DisplayDialog, but it is not working.</p>
  
  <pre><code>// AppProgram.cpp
  ...
  LRESULT CALLBACK WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
  {
    switch (msg) {
      case WM_COMMAND:
        switch (LOWORD (wParam)) {
            case IDM_FILE_NEW_DIALOG:
                DisplayDialog (hInst, hWnd);
                break;
            ...
        }
        break;
        ....
    }
   return DefWindowProc(hWnd, msg, wParam, lParam);
  }
  </code></pre>
  
  <p>My DLL appears like</p>
  
  <pre><code>#include "stdafx.h"
  #include "myDLL.h"
  
  EXPORT BOOL CALLBACK DisplayDialog (HINSTANCE hInst, HWND hWnd) {
     DialogBox (hInst, MAKEINTRESOURCE (IDD_DIALOG1), hWnd, reinterpret_cast&lt;DLGPROC&gt; (DiagProc));
     // MessageBox works here
  }
  ...
  </code></pre>
  
  <p>I've tested that this DLL displays dialog if the dialog belongs to AppProgram.
  Here, I want to display dialog when it is a part of DLL.</p>
  
  <p>Please suggest whether we should create dialog inside DLL or should pass it from program. + how to show dialog in given scenario. Thanks in advance.</p>