Announcement

Collapse
No announcement yet.

How I get an icon ... ?

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

  • #21
    Howdy, Detlev!

    A tip - when you post code, don't use the Quotes tag. Use the Code tag.

    You can even go back in the posts you've made in this thread and change them - the post will be much cleaner.

    Comment


    • #22
      While using the PBCC compiler. Make the following changes to your source code:
      Code:
      #COMPILE EXE
      #DIM ALL
      #INCLUDE "win32api.inc"                  ' Note, makes "start:" an 'invalid label' - use "pStart:" instead  <<
      ..
      ..
      GRAPHIC WINDOW cp,x1,y1,x2,y2 TO hwin
       Local hIcon As Dword
        hIcon = LoadIcon(GetModuleHandle(""), "#100")          ' handle to resource Icon - for GFX Window to use
        SendMessage hWin, %WM_SETICON, %ICON_SMALL, hIcon      ' Caption bar & Taskbar Icon for Graphic Window
      GRAPHIC ATTACH hwin,0
      ..'
      Rgds, Dave

      Comment


      • #23
        '
        Code:
        'Dave's API calls adapted
        #compile exe 'for PBCC
        #dim all
        #console off
        #resource icon, 101, "test.ico"
        #include "WinUser.inc"
        '
        function winmain (byval hInstance as dword, _  'use WINMAIN instead of PBMAIN
                          byval hPrevInst as dword, _  'and GETMODULEHANDLE to get hInstance
                          byval pCmdLine as wstringz ptr, _
                          byval nCmdShow as long) as long
          local hGWin, hIcon as dword
          graphic window new "G Win", 100, 90, 200, 150 to hGWin
          hIcon = LoadIcon(hInstance, "#101")
          SendMessage hGWin, %WM_SETICON, %ICON_SMALL, hIcon
          '
          graphic waitkey$ 'any key will exit
          graphic window end hGWin
        end function '
        Cheers,
        Last edited by Dale Yarker; 21 Aug 2020, 09:02 AM.
        Dale

        Comment


        • #24
          Hi Dale,

          that was the success that I failed to see despite my best efforts.

          The problem is too specific, since the simple situation only populates the pure console window and the program with the icon.

          Now with the program snippet, my knowledge expands.

          I was extremely close to despair and wanted to let PowerBasic rest again.

          Thank you Robert Zale posthumously



          Comment

          Working...
          X