Announcement

Collapse
No announcement yet.

System Icon Does not Show in Shortcut or Taskbar

Collapse
X
 
  • 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 ...

    Code:
             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
    Gary

    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?

    Kerry

    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

    Comment


    • #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.

      Comment


      • #4
        Try setting %ICON_SMALL too. This works for me:
        Code:
          DIALOG SEND hDlg, %WM_SETICON, %ICON_SMALL, LoadIcon(%NULL, BYVAL %IDI_APPLICATION)
          DIALOG SEND hDlg, %WM_SETICON, %ICON_BIG, LoadIcon(%NULL, BYVAL %IDI_APPLICATION)

        Comment


        • #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?

          Comment


          • #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.

            Code:
            'Compilable Example:
            #Compile Exe
            #Dim All
            %Unicode = 1
            #Include "Win32API.inc"
            
            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

            Comment


            • #7
              Gary,

              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!

              -John

              Comment

              Working...
              X