I think you should add your codes before DoModal(). Before DoModal(), your instance must have been created or declared. as: CMyDialog m_MyDialog; if(...) { m_MyDialog.DoModal(); } or you can put the first declaration into the calling class's InitInstance(), OnCreate(), or Contructor.
哪位高手,快指点一下
Before DoModal(), your instance must have been created or declared. as:
CMyDialog m_MyDialog;
if(...)
{
m_MyDialog.DoModal();
}
or you can put the first declaration into the calling class's InitInstance(), OnCreate(), or Contructor.
在OnInitDialog ()中
if (NeedMinimize ()) // 读注册表看是否需要隐藏
PostMessage(WM_SIZE, SIZE_MINIMIZED, 0); // 发送最小化消息在OnSize ()中
{
CDialog::OnSize(nType, cx, cy);
if (SIZE_MINIMIZED == nType)
{
HideMe (); // Hide to system tray
}
}
本代码在我的一个工具中实现,不过启动是会闪烁一下。
“在InitDialog()里用ShowWindow(...),然后启动热键的时候用ShowWindow()……”。不好用的,对话框依旧出现。To:zhaijunlong
是个对话框程序,只有一个窗体。
PostMessage(WM_SHOWWINDOW, FALSE, SW_OTHERUNZOOM);