开发者

CDialog doesnt show in task bar

Im trying to get a CDialog that has no border or frame to show in the task bar.

It is created in the InitInstance of CWinApp (used to update the app) and i have tried setting the WS_EX_APPWINDOW flag but it still doesnt show in the task bar.

Any ideas?

Edit: As defined in the resource:

IDD_UPDATEFORM_DIALOG DIALOGEX 0, 0, 246, 124
STYLE WS_POPUP
EXSTYLE WS_EX_APPWINDOW
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
END

As used:

 UpdateForm *dlg = new UpdateForm(UPDATE_FILES, CWnd::GetDesktopWindow());
 INT_PTR nResponse = dlg->DoModal();


UpdateForm::UpdateForm(int updateType, CWnd* pParent) : CDialog(IDD_UPDATEFORM_DIALOG, pParent)开发者_C百科
{
 m_bInit = false;
 m_hIcon = AfxGetApp()->LoadIcon(IDI_ICON);
 m_Progress = new DesuraProgress();
 m_updateType = updateType;
}

Still Shows up like so:

http://update.goldeneyesource.net/lodle/noicon.jpg http://update.goldeneyesource.net/lodle/noicon.jpg


Edit #2:

To set the icon for this window (essentially a splash screen), you can send the window a WM_SETICON message along with a desired icon.

For a dialog, you can do this in OnInitDialog(). Here's a snippet that uses the default windows information icon as noted here: LoadIcon @ MSDN.

// CHelperDlg message handlers
BOOL CHelperDlg::OnInitDialog()
{
  CDialog::OnInitDialog();

  // 32516 is also known as IDI_INFORMATION
  HICON hIcon = LoadIcon(0, MAKEINTRESOURCE(32516));

  // 0 in WPARAM is 'small version'
  ::SendMessage(GetSafeHwnd(), WM_SETICON, 0, (LPARAM)hIcon);
  // 1 in WPARAM is 'large version'
  ::SendMessage(GetSafeHwnd(), WM_SETICON, 1, (LPARAM)hIcon);

  // No cleanup as HICONs are free from disposal rules.

  return TRUE;  // return TRUE unless you set the focus to a control
  // EXCEPTION: OCX Property Pages should return FALSE
}

--
Edit:

I created a second project to mimic your update, but I don't see any differences except the inclusion of DS_SHELLFONT (DS_SETFONT | DS_FIXEDSYS) in my .rc file. These dialog style definitions don't affect the display of the dialog.

I've uploaded key parts for my minimal example to http://gist.github.com/461057 for your reference, in case you'd like to try adding this dialog ahead of yours for testing.

Also, I'm using VS2010. I have VS2008 available if you'd like me to repeat this test in that version as well.

--
Original:

Try specifying the desktop window (via CWnd::GetDesktopWindow()) as the parent window when you create the dialog.

// Member Variable
CHelperDlg *dlg;

// Meanwhile, elsewhere...
dlg = new CHelperDlg();
dlg->Create(IDD_HELPERDLG, CWnd::GetDesktopWindow());
dlg->ShowWindow(SW_SHOW);
// or...
// dlg->DoModal();

Also, don't forget to destroy the dialog when you're done with it, either in the destructor of the class owner, or other convenient location.


I figured out a hack to get this to work. Instead of disabling the toolbar/caption bar styles to get no border, i used SetWindowRgn to clip the frame and title bar. Same affect, less issues.

RECT rect;
GetWindowRect(&rect);
int w = rect.right - rect.left;
int h = rect.bottom - rect.top;

HRGN region = CreateRoundRectRgn(5, 30, w-5, h-5-30, 5, 5);
SetWindowRgn(region, true);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜