Taskbar/Caption Bar Icon

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • Howard L Burkhardt
    Member
    • Sep 1998
    • 5

    Taskbar/Caption Bar Icon

    Hello,

    Using DDT, how do you change the the default icon to use the
    resource icon instead of the default windows icon?

    Code:
    #COMPILE EXE
    #REGISTER NONE
    #RESOURCE "Hlb.pbr"
    DEFLNG a-z
    
    #INCLUDE "Ddt.inc"
    
    FUNCTION PBMAIN AS LONG
      DIALOG NEW 0, "Test", 0, 0, 100, 50, _
        %DS_CENTER OR %WS_MINIMIZEBOX OR %WS_SYSMENU, 0 TO hDlg
      DIALOG SHOW MODAL hDlg
    END FUNCTION
    Howard Burkhardt
  • Semen Matusovski
    Member
    • Sep 1999
    • 3358

    #2
    Howard --
    If you'll search BBS by "WM_SETICON" (much better in Borje's POFFS), you find a lot of samples.

    But there is another way:

    Code:
       #Compile Exe
       #Register None
       #Dim All
       #Include "Win32Api.Inc"
       
       Function PbMain
    
          Local hDlg As Long
          Dialog New 0 ,"Icon", , , 200, 100, %WS_CAPTION Or %WS_SYSMENU To hDlg
          SetClassLong hDlg, %GCL_HICON, LoadIcon (ByVal 0&, ByVal %IDI_WARNING)
          Dialog Show Modal hDlg
    
       End Function

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

    Comment

    • Howard L Burkhardt
      Member
      • Sep 1998
      • 5

      #3
      Hello,

      Thanks. I was able to get it to work an here is the sample code
      that works. First the HLB.RC file:

      HLBICON ICON HLB.ICO

      Then the PowerBASIC code:

      Code:
      #COMPILE EXE
      #REGISTER NONE
      #RESOURCE "Hlb.pbr"
      DEFLNG a-z
      
      #INCLUDE "Win32api.inc"
      
      FUNCTION PBMAIN
      
        hInstance=GetModuleHandle("")
      
        DIALOG NEW 0 ,"Test" , , , 120, 60, %WS_CAPTION OR %WS_SYSMENU TO hDlg
        DIALOG SEND hDlg, %WM_SETICON, %ICON_BIG, LoadIcon(hInstance, "HLBICON")
        DIALOG SHOW MODAL hDlg
      
      END FUNCTION
      Howard L. Burkhardt

      Comment

      Working...
      X