Note that there are some explanatory texts on larger screens.

plurals
  1. POCPrintDialog::OnInitDialog does not get called every time
    primarykey
    data
    text
    <p>I am using MyPrintDialog extended CPrintDialog. The problem is: OnInitDialog() method of MyPrintDialog does not get called on first time when the application try to open Print dialog.</p> <p>I am trying to set the Printer name in the Print Dialog from the OnInitDialog() method. Printer name is specified by the user in the application which I want to use for the Printing.</p> <p>My OnInitDialog() method</p> <pre><code>CComboBox *wndCmbBox = (CComboBox *)GetDlgItem( IDC_PER_USER ); /*IDC_PER_USER which is ID of Prin Dialog combo */ if( wndCmbBox != NULL ) { wndCmbBox-&gt;SelectString( -1, PrinterName ); } </code></pre> <p>Or is their any way to set the user choice Printer name in the Print dialog..?</p> <p>Please Explain.</p> <p><strong>Edit</strong></p> <p>Yes, by onInit() I mean <code>OnInitDialog()</code></p> <p>I am using VS 2012 with Win7 32 bit. I am facing this issue only first call of <code>DoModel()</code>. Next consecutive <code>DoModel()</code> methods calls <code>OnInitDialog()</code>. I have debug the issue and found something</p> <pre><code>INT_PTR CALLBACK AfxDlgProc(HWND hWnd, UINT message, WPARAM, LPARAM) { if (message == WM_INITDIALOG) { // special case for WM_INITDIALOG CDialog* pDlg = DYNAMIC_DOWNCAST(CDialog, CWnd::FromHandlePermanent(hWnd)); if (pDlg != NULL) return pDlg-&gt;OnInitDialog(); else return 1; } return 0; } </code></pre> <p>The above is the function of dlgcore.cpp. When issue is reproduced I observed that <code>DYNAMIC_DOWNCAST</code> returns <code>NULL</code>.</p> <p>Please note that I have customized CPrintDialog and added one check box in it. I doubt if it is creating the issue.</p>
    singulars
    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