Announcement

Collapse
No announcement yet.

Old icon in properties dialog

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Old icon in properties dialog

    G'daye,
    I've experienced a completely new phenomenon in Windows NT. During development I decided to change the so called program icon for one of my applications. I modified the .RC file and then recompiled.
    The dialog shows up with the new icon in its taskbar. I also see this icon when exploring the programs directory. But in the properties dialog (right mouse button) I still see the old icon, despite a reboot.
    This only happens under Windows NT. In Win95 I initially saw the old one, but after a reboot the problem was solved.
    Any idea?

    ------------------
    mailto:[email protected][email protected]</A>
    www.basicguru.com/zijlema/

    Egbert Zijlema, journalist and programmer (zijlema at basicguru dot eu)
    http://zijlema.basicguru.eu
    *** Opinions expressed here are not necessarily untrue ***

  • #2
    Egbert --
    which length has ico ?
    If 2734 (?) instead of 766 bytes, I guess that three images (16 * 16, 32 * 32, 48 * 48) do not correspondend each other.




    ------------------
    E-MAIL: [email protected]

    Comment


    • #3
      Semen,
      Icon length = 766 bytes.

      Strange thing: after renaming the application all looks okay, but when renaming it to its old filename again, the wrong icon re-appears.

      ------------------
      mailto:[email protected][email protected]</A>
      www.basicguru.com/zijlema/

      Egbert Zijlema, journalist and programmer (zijlema at basicguru dot eu)
      http://zijlema.basicguru.eu
      *** Opinions expressed here are not necessarily untrue ***

      Comment


      • #4
        Semen,
        Problem solved (I think/hope).
        In the following code I changed %ICON_BIG into %ICON_SMALL:
        Code:
        hInst = GetModuleHandle("")
        SendMessage CBHNDL, %WM_SETICON, %ICON_SMALL, LoadIcon(hInst, "ICON1")
        Obviously it has to do with the measurements (thanks for your question pointing to this aspect), although I do not understand how it works internally.
        When use %ICON_BIG and when %ICON_SMALL?

        ------------------
        mailto:[email protected][email protected]</A>
        www.basicguru.com/zijlema/

        Egbert Zijlema, journalist and programmer (zijlema at basicguru dot eu)
        http://zijlema.basicguru.eu
        *** Opinions expressed here are not necessarily untrue ***

        Comment


        • #5
          Small icon is used for caption, big - for Alt-Tab.
          Theoretically, this means that it's necessary to set both icons.

          I don't understand one important detail - hIcon includes all images or one only.

          From one side, there are reasons to think that one only. If to read MSDN:
          1) LoadIcon can only load an icon whose size conforms to the SM_CXICON and SM_CYICON system metric values (32 * 32).
          Alone function, where it possible to select desired size (16*16/32*32/48*48) is LookupIconIdFromDirectoryEx.
          2) The LoadIcon, LoadImage, and LoadCursor functions use this function to search the specified resource data for the icon or cursor that best fits the current display device.
          It's possible to understand that LoadIcon asks LookupIconIdFromDirectoryEx with SM_CXICON and SM_CYICON.
          3) GetIconInfo can operate with one image only.

          But what I see under Win2000... I created an icon with different pictures for 16*16 ("a") / 32 * 32 ("b") / 48 * 48
          a) Alone SendMessage hDlg, %WM_SETICON, %ICON_SMALL, hIcon sets caption icon only and is used picture "b" (as expected).
          b) ICON_SMALL + ICON_BIG sets caption and ALT-TAB icons to picture "b". Also clear.
          c) Alone ICON_BIG sets picture "a" in caption and "b" in ALT-TAB.
          Very strange, because I transfered hIcon only.
          If picture "a" remains in hIcon together with "b", this, as I understand, conflicts with MSDN.
          But, from another side, what should I think ?

          ------------------
          E-MAIL: [email protected]

          Comment


          • #6
            Hello folks,
            I think Semen is right: you should set both (during %WM_INITDIALOG), %ICON_BIG and %ICON_SMALL. And this is not 'theoretically', as Semen states, it's necessary practice.
            According to MSDN the icon that has to appear in the window's caption must be set as %ICON_SMALL. But if you don't set %ICON_BIG as well, there will be no application icon in the Alt-Tab dialog (the system will use the default Windows icon instead). And if you only set %ICON_BIG you may encounter the problem that made me start this thread.
            The best test is to use 2 different icons, to see what happens.

            ------------------
            mailto:[email protected][email protected]</A>
            www.basicguru.com/zijlema/



            [This message has been edited by Egbert Zijlema (edited March 07, 2001).]

            Egbert Zijlema, journalist and programmer (zijlema at basicguru dot eu)
            http://zijlema.basicguru.eu
            *** Opinions expressed here are not necessarily untrue ***

            Comment


            • #7
              Code:
              Another possibility during %WM_INITDIALOG:
                 
              SetClassLong CBHNDL, %GCL_HICON, LoadIcon(hINST&, "ICON1")
              ------------------
              -- Greg
              [email protected]

              Comment


              • #8
                Thank you Greg,

                I believe this is the one we need. I did'nt know that API call.
                In my opinion this is similar to what happens when you built a window, using WinMain instead of PBMain. In that case you set a WndClass for both, the small icon and the big one.
                But since we're using DDT-built dialogs for our applications, instead of that classic one, we need a sort of an alternative. I'm sure you've found it.

                And speaking about the icon issue, in the Programming forum I've posted a problem with the Image Editor that was delivered with PBDLL60, but nobody has seen that probably. So, again:
                I'm encountering the following problem, using Image Editor as delivered with PBDLL60: when trying to load an existing icon from disk, ImgEdit reports the following error: "Not a valid 3.0 format icon or cursor".
                I assume PB provided an older version. Where can I get a newer edition?


                ------------------
                mailto:[email protected][email protected]</A>
                www.basicguru.com/zijlema/

                Egbert Zijlema, journalist and programmer (zijlema at basicguru dot eu)
                http://zijlema.basicguru.eu
                *** Opinions expressed here are not necessarily untrue ***

                Comment


                • #9
                  You should NOT use the class directly!
                  Other dialogs from the same class will get the same icon.

                  ------------------
                  hellobasic

                  Comment


                  • #10
                    Code:
                     
                    Other dialogs from the same class will get the same icon
                    And isn't this, more often than not, exactly what is desired?


                    ------------------
                    -- Greg
                    [email protected]

                    Comment


                    • #11
                      Greg --
                      May be you are right that this is often desired (because inside one app).
                      But I think that it's better to have a practice to set %GCL_HICONSM also.

                      Egbert --
                      Microsoft IconEdit is really old and (99,9% sure) was freeware.
                      There are no new Microsoft icon editors (as I understand).

                      I tried some new freeware icon editors. If necessary, I can give links, but, honestly, all of them have serious defects.

                      Alone icon editor, which I liked more or less, was shareware MicroAngelo (now exist release 5.0).
                      To create cur/ani it's possible to use CursorDance (freeware; you can download it from ZDNet).

                      ------------------
                      E-MAIL: [email protected]

                      Comment

                      Working...
                      X