Display Taskbar Icon in Dialog without WS_CAPTION & WS_SYSMENU

Hi,

In my application I have several popup dialogs with custom skins.  The skins means that the dialogs cannot have a border. However, I would still like to display icons for the dialog in their taskbar captions.  I've tried everything I can think of without success and so would be grateful if anyone can suggest a solution.

Thanks in advance,

Steve.
LVL 1
sjhlAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
dandycheungConnect With a Mentor Commented:
0
 
robpittCommented:
I'm afraid the only way to get icons on the taskbar is to give the top level window the appropriate window style (WS_SYSMENU if I recall correctly).
0
 
robpittCommented:
... in other words I don't think its possible.
0
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
jtwine100697Commented:
Do you want each pop-up dialog to appear in the taskbar, with an icon, or are you saying that your dialog already appears in the taskbar, but without an icon, and you want to fix that?

-=- James.
0
 
sjhlAuthor Commented:
James,

The dialog already appears in the taskbar but without an icon. If it's any help the dialogs are created with the desktop as their parent.  If there's no other way to do it, and if it works I could create a hidden dialog with WS_CAPTION and WS_SYSMENU to use as their parent window, but I was hoping for a quicker solution.

Thanks,

Steve.
0
 
jtwine100697Commented:
The way you mention is referenced in an MSDN article (I think, it sounds familiar).

I wanted to know if you have explicitly set a large and small icon for the dialog window?

-=- James.
0
 
sjhlAuthor Commented:
Yeah, I've set the large and small icons.  The ALT-TAB icon is shown, but not the caption bar icon.

Regards,

Steve.
0
 
jtwine100697Commented:
You have just crossed out of my area of expertise.  Sorry I cannot help you further.

-=- James.
0
 
sjhlAuthor Commented:
Thanks anyway!
0
 
dandycheungCommented:
WM_SETICON
0
 
jtwine100697Commented:
> WM_SETICON

   But the OP already said (in a response):

> > Yeah, I've set the large and small icons.  

???

-=- James.
0
 
egsemsemCommented:
There must be a way to do this, I have seen a program did it before (System Mechanic).
0
 
jtwine100697Commented:
Just a thought, but could you set yourself up with a WS_CAPTION Style, and just handle painting of the caption yourself, perhaps painting it transparent?  Kludgy, I know, but just a thought...

-=- James.
0
 
sjhlAuthor Commented:
Nice idea if it's the only way. Do you have any idea how to handle this?  If it's possible I imagine it's by handling WM_NCPAINT and WM_NCACTIVATE, but how do you distinguish between the Dialog Caption and the Taskbar Caption?

Thanks,

Steve.
0
 
jtwine100697Commented:
Yer right.  I was thinking of something else entirely when I wrote that.  Sorry about that.

-=- James.
0
 
bighead1997Commented:
Some shell function can add icon to taskbar,but when user
click it ,I don't what would happen ,I'll check that book later.
0
 
dandycheungCommented:
0
 
dandycheungCommented:
0
 
dandycheungCommented:
I can not post my answer because of some EE's system error, you can send me a email and I will give a demo application to you. I have solved your problem. my mail address: dandycheung@21cn.com
0
 
egsemsemCommented:
dandycheung ... we want the answer too .. please try to contact EE support team.
0
 
dandycheungCommented:
All steps:

1. Use Visual C++ 6.0 AppWizard create a new project which type is "Win32 Application".
2. Choose "A simple Win32 Application" in step 1, click finish.
3. Insert a new dialog(IDD_DLG_TEST).
4. Open the properties dislog of this dialog, choose "Styles" tab, remove the check of "Title bar".
5. Save this dialog to file test.rc
6. Open test.rc file and add WS_SYSMENU style to the dialog manually and save it.
7. Return to VC IDE, add test.tc to your project.
8. Clear your main .cpp file and paste these code below:

#include "stdafx.h"
#include "resource.h"

INT_PTR CALLBACK DlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);

int APIENTRY WinMain(HINSTANCE hInstance,
                     HINSTANCE hPrevInstance,
                     LPSTR     lpCmdLine,
                     int       nCmdShow)
{
      // TODO: Place code here.

     if(DialogBox(hInstance, MAKEINTRESOURCE(IDD_DLG_TEST), NULL, (DLGPROC)DlgProc) == IDOK)
     {
     }
     else
     {
     }

     return 0;
}

INT_PTR CALLBACK DlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
     switch(uMsg)
     {
     case WM_INITDIALOG:
          {
               HICON hIcon = (HICON)LoadImage(NULL, "doc.ico", IMAGE_ICON, 0, 0, LR_LOADFROMFILE);
               if(hIcon)
               {
                    SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)hIcon);
                    SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM)hIcon);
               }
          }
          break;
     case WM_COMMAND:
          if(wParam == IDOK)
          {
               EndDialog(hwndDlg, IDOK);
               return TRUE;
          }
          break;
     }

     return FALSE;
}

9. Build your project.
10. Remember to place a icon file named doc.ico to the folder as same as the application file standing.
11. Run your application.
0
 
sjhlAuthor Commented:
I have solved it with

SetWindowLong(GWL_STYLE, WS_SYSMENU);

but your solution also works, so I'm happy to give you the points and thank you for your help.

Regards,

Steve.
0
 
bighead1997Commented:
OK,i find it ;
first u create a button window,then subclass its winproc with you own;
then get a ITaskBarList interface pointer,use AddTab function to add the button to taskbar,
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.