Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. How to hide main dialog

How to hide main dialog

Scheduled Pinned Locked Moved C / C++ / MFC
helpc++tutorialquestion
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    Crystal
    wrote on last edited by
    #1

    I have a dialog-based application. I would like to hide the main dialog and display an icon only in the system tray. I've tried to use ShowWindow(SW_HIDE), but the dialog still appears. In "ApplicationName.cpp" file and in "InitInstance" module, my codes look like the following: CFwuTestDlg dlg; //1 //the main dialog m_pMainWnd = &dlg; //2 m_pMainWnd->ShowWindow(SW_HIDE);//3 m_pMainWnd->UpdateWindow();//4 int nResponse = dlg.DoModal();//5 return FALSE;//6 I've tried to delete line 5, but Windows complains that .exe file generate error. Could anyone help me? Thank you.

    S 1 Reply Last reply
    0
    • C Crystal

      I have a dialog-based application. I would like to hide the main dialog and display an icon only in the system tray. I've tried to use ShowWindow(SW_HIDE), but the dialog still appears. In "ApplicationName.cpp" file and in "InitInstance" module, my codes look like the following: CFwuTestDlg dlg; //1 //the main dialog m_pMainWnd = &dlg; //2 m_pMainWnd->ShowWindow(SW_HIDE);//3 m_pMainWnd->UpdateWindow();//4 int nResponse = dlg.DoModal();//5 return FALSE;//6 I've tried to delete line 5, but Windows complains that .exe file generate error. Could anyone help me? Thank you.

      S Offline
      S Offline
      Sam Hobbs
      wrote on last edited by
      #2

      First, you do not need to hide the dialog. The way that the system tray works is that windows are minimized to be not shown. http://www.codeproject.com/shell/systemtray.asp http://home.socal.rr.com/samhobbs/VC/TaskbarStatusIcon.html You certainly do not want to remove the DoModal (line 5) but you do want to remove the ShowWindow and UpdateWindow (lines 3 and 4).

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups