Note that there are some explanatory texts on larger screens.

plurals
  1. POAtl CDialogImpl not showing on DoModal if called from static library
    primarykey
    data
    text
    <p>I wrote a super simple ATL dialog inside a project. Even when I noted that every example on the web implemented the CDialogImpl class inline (that is, the class definition and it's implmentation where in the definition itself) I wrote it normally, separating my definition in a .h file and implementation in a .cpp file. This class is summarized below:</p> <h2>CMainDialog.hpp</h2> <pre><code>class CMainDialog: public CDialogImpl&lt;CMainDialog&gt; { public: enum { IDD = IDD_MYDIALOGS_DIALOG}; BEGIN_MSG_MAP(CMainDialog) MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog) COMMAND_ID_HANDLER(IDCANCEL, OnCancel) END_MSG_MAP() CMainDialog(); ~CMainDialog(); LRESULT OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL&amp; bHandled); LRESULT OnCancel(UINT uMsg, WORD wID, HWND hWndCtl, BOOL&amp; bHandled); } </code></pre> <h2>CMainDialog.cpp</h2> <pre><code>CMainDialog::CMainDialog() { } CMainDialog::~CMainDialog() { } LRESULT CMainDialog::OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL&amp; bHandled) { } LRESULT CMainDialog::OnCancel(UINT uMsg, WORD wID, HWND hWndCtl, BOOL&amp; bHandled) { } </code></pre> <p>If I call this class from the same project, everything goes fine. The dialog shows. Example:</p> <h2>Calling DoModal</h2> <pre><code>int APIENTRY _tWinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance, _In_ LPTSTR lpCmdLine, _In_ int nCmdShow) { UNREFERENCED_PARAMETER(hPrevInstance); UNREFERENCED_PARAMETER(lpCmdLine); CMainDialog dialog; dialog.DoModal(); return 0; } </code></pre> <p>So I converted this project from <code>.exe</code> to <code>static library</code> and removed _tWinMain. So, if I create a new ATL project, reference my newly created library and call CMainDialog.DoModal ... well, nothing happens. The constructor does get called, but the messages never start dispatching and the program ends inmediatly. Maybe I'm missing something?</p> <p>I'm totally new to Win32 programming (although definitely not new to c++) so any help would be appreciated.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload