本文整理汇总了C++中CDialog::InitControls方法的典型用法代码示例。如果您正苦于以下问题:C++ CDialog::InitControls方法的具体用法?C++ CDialog::InitControls怎么用?C++ CDialog::InitControls使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CDialog
的用法示例。
在下文中一共展示了CDialog::InitControls方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DlgProc
WCL::DlgResult DIALOGPROC CDialog::DlgProc(HWND hWnd, UINT iMsg, WPARAM wParam, LPARAM lParam)
{
// Store the return values for this message.
BOOL bMsgHandled = false;
LRESULT lMsgResult = 0;
try
{
CDialog* pDialog;
// Get the window object.
pDialog = static_cast<CDialog*>(CWnd::s_WndMap.Find(hWnd));
// Do we have a mapping?
if (pDialog == nullptr)
{
// Time to initialise?
// NB: We will receive other messages first.
if (iMsg == WM_INITDIALOG)
{
// Get object from LPARAM.
pDialog = reinterpret_cast<CDialog*>(lParam);
//
// This function can be called recursively so we need to use
// the program stack to hold the return values for each
// message whilst it is being precessed.
//
// Push the existing messages' return values onto the stack.
BOOL* pbMsgHandled = pDialog->MsgHandledBuffer(&bMsgHandled);
LRESULT* plMsgResult = pDialog->MsgResultBuffer (&lMsgResult);
// Save handle/result.
pDialog->m_hWnd = hWnd;
pDialog->MsgHandled(true);
pDialog->MsgResult (0);
// Setup Window mapping.
CWnd::s_WndMap.Add(*pDialog);
// Centre only if modal.
if (pDialog->m_bModal)
pDialog->Centre();
// Initialise child controls.
pDialog->InitControls();
pDialog->InitGravityTable();
// Now call initialise method.
pDialog->OnCreate(pDialog->ClientRect());
// Pop the old messages' return values back off the stack.
pDialog->MsgHandledBuffer(pbMsgHandled);
pDialog->MsgResultBuffer (plMsgResult);
}
}
else
{
//
// This function can be called recursively so we need to use
// the program stack to hold the return values for each
// message whilst it is being precessed.
//
// Push the existing messages' return values onto the stack.
BOOL* pbMsgHandled = pDialog->MsgHandledBuffer(&bMsgHandled);
LRESULT* plMsgResult = pDialog->MsgResultBuffer (&lMsgResult);
// Call real message handler.
pDialog->WndProc(hWnd, iMsg, wParam, lParam);
// Pop the old messages' return values back off the stack.
pDialog->MsgHandledBuffer(pbMsgHandled);
pDialog->MsgResultBuffer (plMsgResult);
}
}
catch (const Core::Exception& e)
{
WCL::ReportUnhandledException( TXT("Unexpected exception caught in DlgProc()\n\n")
TXT("Message: H=0x%p M=0x%08X W=0x%08X L=0x%08X\n\n%s"),
hWnd, iMsg, wParam, lParam, e.twhat());
}
catch (const std::exception& e)
{
WCL::ReportUnhandledException( TXT("Unexpected exception caught in DlgProc()\n\n")
TXT("Message: H=0x%p M=0x%08X W=0x%08X L=0x%08X\n\n%hs"),
hWnd, iMsg, wParam, lParam, e.what());
}
catch (...)
{
WCL::ReportUnhandledException( TXT("Unexpected unknown exception caught in DlgProc()\n\n")
TXT("Message: H=0x%p M=0x%08X W=0x%08X L=0x%08X"),
hWnd, iMsg, wParam, lParam);
}
// Set the return value.
::SetWindowLongPtr(hWnd, DWLP_MSGRESULT, lMsgResult);
// Return if msg was handled.
//.........这里部分代码省略.........