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
R

rfparker

@rfparker
About
Posts
3
Topics
1
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Property sheet-based app has icon problems
    R rfparker

    Yes, that might be a better way to do it (though AppWizard puts the call to DoModal() in a dialog-based app's InitInstance()) and I've made that change. It makes no difference to the functionality that I see. Since I can get the correct title bar and Alt-Tab icons to appear by setting them in the property sheet's OnInitDialog(), the real issue is the button on the taskbar. I guess the modeless dialog is considered the main window for the task (it has to be created first), since when it is displayed the button appears and as soon as it is hidden (SW_HIDE) the button disappears. So I can't hide the modeless dialog without also disappearing the taskbar button. So for now I'm not hiding the modeless dialog, which is undesirable. There is also the issue of the initial icon on the taskbar button. I've added SetWindowText() to the modeless dialog's OnInitDialog() to set the proper caption, since there's no title bar, and added WS_SYSMENU to the .rc to force the icon to appear, but, until the property sheet loads the icon I want, I see the MFC cube icon in the taskbar button. After the property sheet loads the icon, that one is always displayed on the taskbar, even when I've temporarily destroyed the property sheet and the modeless dialog has reappeared. What I'd like is to be able to hide the modeless dialog when I display the property sheet and not have the taskbar button disappear, and to set the taskbar button's icon so the MFC cube doesn't appear.

    C / C++ / MFC c++ tutorial question

  • Property sheet-based app has icon problems
    R rfparker

    SetIcon() returns 0 (zero) rather than a handle to an icon. I'm not sure what you mean about the application's icons being locked by the modeless dialog; how would I investigate this possibility? And if this is the case, can I make the dialog unlock them? The dialog lives as long as the app and is hidden or displayed, with different messages, as I change modes while communicating with the instrument.

    C / C++ / MFC c++ tutorial question

  • Property sheet-based app has icon problems
    R rfparker

    I am developing a property sheet-based application on XP using VC++ 6. When it starts it talks briefly to an instrument over a serial port in app::InitInstance(), creates the property sheet, adds a few pages, and does an appSheet.DoModal() to make it appear. In order to get an icon to appear in the taskbar and Alt-Tab, I use this code in appSheet::OnInitDialog():

    // Set the icons for the app
    AfxGetMainWnd()->SetIcon(AfxGetApp()->LoadIcon(IDR_MAINFRAME), TRUE);
    AfxGetMainWnd()->SetIcon(AfxGetApp()->LoadIcon(IDR_MAINFRAME), FALSE);

    The app works just fine, and until I added a slight twist mentioned next the icons appeared as expected. For the several seconds during which the app is initially talking to the instrument the user sees nothing happening. So at the beginning of app::InitInstance() I create a modeless dialog that asks the user to be patient while the app starts up, and then hide the dialog at the end of the startup property page's OnInitDialog(). This works fine and looks great. Except that now SetIcon(), above, returns 0 and I get the generic white window icon for Alt-Tab and nothing in the taskbar. The icon in the title bar is still correct. If I use the following code in place of the previous code, I can get the icon to display when I do an Alt-Tab, but nothing shows up in the taskbar.

    HICON hIcon=AfxGetApp()->LoadIcon(IDR_MAINFRAME);
    CWnd* pFrame=AfxGetMainWnd();
    ::SetClassLong(pFrame->GetSafeHwnd(), GCL_HICON, (long)hIcon);

    Interestingly, until I do this the generic MFC icon shows up in the taskbar. Any ideas why this is happening and how to get my icon and app name to appear in the taskbar? Thanks

    C / C++ / MFC c++ tutorial question
  • Login

  • Don't have an account? Register

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