No announcement yet.

System Icon Does not Show in Shortcut or Taskbar

  • Filter
  • Time
  • Show
Clear All
new posts

  • System Icon Does not Show in Shortcut or Taskbar

    Sometimes I like using a system icon for my app, just to pretty it up without having to include a #Resource or to distribute the ico file, like this ...

             hIcon = LoadIcon(ByVal %Null, ByVal %IDI_Question)  'use a system icon for the dialog
             SendMessage hDlg, %WM_SetIcon, %ICON_BIG, hIcon        'use a system icon for the dialog
    The icon shows in the Dialog caption bar, but not in a shortcut to the EXE nor on the TaskBar when the EXE is running. Can I use a system icon for those two purposes?

  • #2

    I use icons so that I can have easy to use references in my task bar for selecting a program. I also have one program which I want to demonstrate it is running so it puts a nice recognisable icon in the task bar. I like single big colour icons as they stand out. Actually they also make the program stand out in the folder listing.

    But I am quite interested - what is wrong with using #Resource icons?


    ps I have decided to use British spelling in my messages!!
    [I]I made a coding error once - but fortunately I fixed it before anyone noticed[/I]
    Kerry Farmer


    • #3
      Hi Kerry!

      I use #Resource all the time - love it. But sometimes I want to post an example that is easier for forum folks to test out - something that does not depend on other files so that I don't have to post links and folks here don't have to download anything but the code.


      • #4
        Try setting %ICON_SMALL too. This works for me:


        • #5
          But quick test shows setting only big icon show small icon in taskbar when running too, so don't understand the problem. Only have Win7, so maybe later system treats icons slightly different?


          • #6
            Howdy, Borje!

            Win10 here. I pulled out just the basic code. When I compile it, the Explorer listing of the EXE does not show the Question icon.

            If I create a shortcut to the EXE, the shortcut icon is not the Question.

            If I run the app, the TaskBar does have the Question icon. But on the gbProcedures app I recently posted, using similar code, the TaskBar does not display the Question. Likewise, adding the small icon as you suggest does not display the Question in gbProcedures. I'll have to look at that to see what I might have done to make it fail.

            'Compilable Example:
            #Compile Exe
            #Dim All
            %Unicode = 1
            #Include ""
            Global hDlg,hIcon As Dword
            Function PBMain() As Long
               Dialog Default Font "Tahoma", 12, 1
               Dialog New Pixels, 0, "Email Date",300,300,350,200, %WS_OverlappedWindow To hDlg
               Dialog Show Modal hDlg Call DlgProc
            End Function
            CallBack Function DlgProc() As Long
               Select Case Cb.Msg
                  Case %WM_InitDialog
                     hIcon = LoadIcon(ByVal %Null, ByVal %IDI_Question)  'use a system icon for the dialog
                     SendMessage hDlg, %WM_SetIcon, %ICON_BIG, hIcon        'use a system icon for the dialog
               End Select
            End Function


            • #7

              This is a TWAG... (Totally Wild A$$ Guess)

              Thought crossed my mind:
              Maybe Win won't display the icon if there's not enough space for it? (similar to when a control doesn't have enough height for a font)

              So I don't know if this is relevant, but I recalled seeing something that may be worth a look:
              Look at the API Help for: GetSystemMetrics, under SM_CXSMICON, SM_CYSMICON...

              I hope this isn't a rabbit-hole looking for a guest!