Announcement

Collapse
No announcement yet.

Form icon doesn't work

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

    Form icon doesn't work

    Maybe something I'm doing wrong, but I can't get an icon attached
    to my form.

    I created my resource file with msvc6. This is the part of my .rc
    file where the icon is named:

    HOCKEY ICON DISCARDABLE "hock.ico"

    I saved it as a res file and converted it to a pbr file.
    In my program I call the icon with :

    hIco = LoadIcon(GetWindowLong(hDlg, %GWL_HINSTANCE), "HOCKEY")
    (hico returns 0 !)
    IF hIco THEN DIALOG SEND hDlg, %WM_SETICON, %ICON_BIG, hIco

    Strange thing is that the compiled file has the icon attached to it.
    The icon is of a 16x16 format.

    What is wrong ?

    (I only see the standard windows icon attached to my form)
    ------------------


    [This message has been edited by Erwin van de Wiel (edited July 27, 2000).]

    #2
    Not icon_big but small

    But LoadIconEx might help you out.
    Or search for my post about loading icons. (by Groupindex)
    Adapt it slightly to load small icons.



    ------------------
    [email protected]
    hellobasic

    Comment


      #3
      Tried the same code with a 16x16 icon and it worked fine. Do you
      get an application instance handle from GetWindowLong()? Did you
      use RC.EXE to create the RES file and then PBRES.EXE to create the
      PBR file?

      ------------------

      Comment


        #4
        Probably, you used lower-case letters for HOCKEY in .RC ?
        Another reason. Win95, RCDATA > 1 Mb

        ------------------


        [This message has been edited by Semen Matusovski (edited July 27, 2000).]

        Comment


          #5
          Not icon_big but small.
          The loadicon call returns 0 so the next line doesn't work at all.

          Probably, you used lower-case letters for HOCKEY in .RC ?
          Another reason. Win95, RCDATA > 1 Mb
          No completely upper case and I use NT4.


          Do you
          get an application instance handle from GetWindowLong()? Did you
          use RC.EXE to create the RES file and then PBRES.EXE to create the
          PBR file?
          No I used vc to create the res file and after that I used pbres to
          create the pbr file. I do get an instance handle back from the
          getwindowlong call. By the way I borrowed this icon code from your
          poffs program.

          ------------------




          [This message has been edited by Erwin van de Wiel (edited July 27, 2000).]

          Comment


            #6
            Problem solved

            I used the string identifier to load the icon, because in vc there
            was no way I could find a place to set the ID. I presumed that I could
            use the string identifier.
            But after a look in the resource.h file I found the ID of the icon.

            After using this the icon finally showed up.

            Anyway thank you for your tips.

            ------------------

            Comment

            Working...
            X
            😀
            🥰
            🤢
            😎
            😡
            👍
            👎