Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5981059
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T21:53:24+00:00 2026-05-22T21:53:24+00:00

I am having a bit of a problem displaying the taskbar icon for a

  • 0

I am having a bit of a problem displaying the taskbar icon for a dialog that my app creates. The main application is a system tray based windows application.

Here is the code I use to create the dialog:

        g_pMainWnd->m_DlgAuth= new CDlg_Auth();
        g_pMainWnd->m_DlgAuth->SetTitle(_T("Authentication"));          
        g_pMainWnd->m_DlgAuth->SetSize(420,420);
        g_pMainWnd->m_DlgAuth->Create(IDD_DLG_AUTH,AfxGetMainWnd());
        g_pMainWnd->m_DlgAuth->ShowWindow(SW_SHOW);
        g_pMainWnd->m_DlgAuth->SetForegroundWindow();

The g_pMainWnd is a global pointer to the main class, Since the creation of the dialog is made in a callback from a child thread.

The taskbar icon is created in MFC’s OnInitDialog method as shown here:

    m_hIcon = (HICON)LoadImage(AfxGetResourceHandle(),MAKEINTRESOURCE(IDR_MAINFRAME),IMAGE_ICON, 0, 0, 0); 

    int cxIcon = GetSystemMetrics(SM_CXSMICON);
    int cyIcon = GetSystemMetrics(SM_CYSMICON);

    m_hIconSmall = (HICON)LoadImage(AfxGetResourceHandle(),MAKEINTRESOURCE(IDR_MAINFRAME),IMAGE_ICON
        ,cxIcon,cyIcon, 0); 

    SetIcon(m_hIconSmall, FALSE);       // Set small icon
    SetIcon(m_hIcon, TRUE);     // Set small icon

The small icon loads perfectly the problem is with the big icon, it does not load at all, the handle gets set and all seems fine but when the taskbar button shows, it shows the default windows console app icon.

I have been at this for a week now and nothing seems to work. I have tried other 32×32 icons, tried loading the dialog from a different thread. I tried to make the callback post a message to the main thread to create the dialog. All the controls in the dialog works fine. It gets all the necessary messages but it doesn’t draw the icon.

Would appreciate any help possible.
Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T21:53:25+00:00Added an answer on May 22, 2026 at 9:53 pm

    Just fixed it by using Sending WM_SETICON message to the main window instead of calling the seticon function

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am having a bit of a problem with a WPF application. The application
) I am having a bit of a problem with my app. I am
I'm having a bit of a problem with a very weird side effect that's
I am having a bit of a problem with an app I'm developing for
Hey guys im having a bit of a problem with my iPhone app where
Having a bit of a problem, Due to the source-control set-up we use, each
Having a bit of a problem creating an instance of an object. Bear in
I am having a bit of a problem. I get a RAW char* buffer
I'm having a bit of a problem. I have a datatable in the parent
I'm having a bit of a problem with converting the result of a MySQL

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.