Announcement

Collapse
No announcement yet.

Is there a way to change the caption

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

  • Dave Biggs
    replied
    Edwin is right. (Naturally )

    SendMessage( hgWin, %WM_SETICON, %ICON_BIG, LoadIcon( 0, ByVal %IDI_EXCLAMATION ) )
    SendMessage( hgWin, %WM_SETICON, %ICON_SMALL, LoadIcon( 0, ByVal %IDI_EXCLAMATION ) )

    The solution I posted also works but is OTT.

    Sendmessage is better (using LoadImage )

    Leave a comment:


  • Edwin Knoppert
    replied
    This is a simple and not profi example but works:
    SendMessage( hgWin, %WM_SETICON, %ICON_BIG, LoadIcon( 0, ByVal %IDI_EXCLAMATION ) )
    SendMessage( hgWin, %WM_SETICON, %ICON_SMALL, LoadIcon( 0, ByVal %IDI_EXCLAMATION ) )

    Notes:
    You should use LoadImage() and use real big *and* small icons.
    Custom icon handles should be freed.

    Leave a comment:


  • Michael Mattias
    replied
    >This is for a CC ap

    So is the linked demo. That compiles and runs 'as is' using either PB/WIN or PB/CC.

    That is, instead of a call to GRAPHIC WINDOW et al, maybe a call to CreateWindowEx would be more appropos for this application.

    It's an idea. Use it or not.

    Leave a comment:


  • Dave Biggs
    replied
    Any ideas on how to create/display a custom icon on the caption line?
    Looks like it isn't normally possible to change the icon of a Graphic Window. Here's a technique though for setting the icon while the window is being created..
    Code:
    #DIM ALL
    #INCLUDE "WIN32API.INC"
    GLOBAL hHook???
     
    FUNCTION HookGFXWindow(BYVAL lMsg AS DWORD, BYVAL wParam AS DWORD, BYVAL lParam AS LONG) AS LONG
     DIM hIcon???
     
      IF lMsg = %HCBT_CREATEWND THEN      ' wParam has handle of Window about to be created
        UnhookWindowsHookEx hHook
        'hIcon = LoadImage(BYVAL %NULL, "Objects.ico", %IMAGE_ICON, 16, 16, %LR_LOADFROMFILE )    ' your icon
        hIcon = LoadIcon(BYVAL %NULL, BYVAL %IDI_EXCLAMATION)       ' std icon - comment out if using your own
        SetClassLong wParam, %GCL_HICONSM, hIcon
      END IF
     
     FUNCTION = 0
    END FUNCTION
    '------------------/HookGFXWindow
     
    FUNCTION PBMAIN()
     DIM gWdw???
     
      hHook = SetWindowsHookEx(%WH_CBT, CODEPTR(HookGFXWindow), GetModuleHandle(""), 0)
      GRAPHIC WINDOW "Test GFX Window", 200, 200, 350, 200 TO gWdw
     
      GRAPHIC ATTACH gWdw, 0
      GRAPHIC PRINT
      GRAPHIC PRINT "  Window title can be a string literal or an asciiz string (variable)"
      SLEEP 1000
     
      SetWindowText gWdw, "** Check out the fancy Icon ! **"   ' <- String literal works ok here
      GRAPHIC WAITKEY$
     
      GRAPHIC WINDOW END
     
    END FUNCTION
    '------------------/PBMain

    Leave a comment:


  • Doug Ingram
    replied
    Originally posted by Michael Mattias View Post
    >Any ideas on how to create/display a custom icon on the caption line?

    License PB/Windows and learn how to write real GUI programs?
    I do have PBWin... but that wasn't the question.
    This is for a CC ap.

    Leave a comment:


  • Michael Mattias
    replied
    on me. You don't need to license PB/Windows to create real GUI programs....

    Directory List with Non-ASCII (Unicode) characters in file names 5-31-08

    Leave a comment:


  • Edwin Knoppert
    replied
    You can do that with PB/CC.
    Console off and SDK stuff.

    Leave a comment:


  • Michael Mattias
    replied
    >Any ideas on how to create/display a custom icon on the caption line?

    License PB/Windows and learn how to write real GUI programs?

    Leave a comment:


  • Doug Ingram
    replied
    Jerry - once again thanks!
    I didn't include the win32api file - that was it!

    Any ideas on how to create/display a custom icon on the caption line?

    Leave a comment:


  • Jerry Fielden
    replied
    Hello Doug, that example is an windows API, but it will work in pbcc graphics, you'll have to include the windows api like I'm showing. I'm using the Same example from last time.


    Code:
    #COMPILE EXE
    #DIM ALL
    #INCLUDE "C:\PBCC40\WINAPI\WIN32API.INC"
    
    FUNCTION PBMAIN () AS LONG
      LOCAL NewCaption AS ASCIIZ * 40
      LOCAL hGWin AS DWORD
      LOCAL t AS STRING
    
      GRAPHIC WINDOW "Undraw test...",0,0,800,600 TO hgwin
      GRAPHIC ATTACH hGWin, 0, REDRAW
      NewCaption = "Howdy Folks"
      SetWindowText(hgWin, NewCaption)
    
      GRAPHIC SET POS (200,300)
      GRAPHIC PRINT "Now is the time for all good men to come to the aid of their country"
      GRAPHIC SET POS (200,340)
      GRAPHIC PRINT "The quick red fox jumped over the lazy dogs back many times."
      GRAPHIC SET POS (200,380)
      GRAPHIC PRINT "Now is the time for all good men to come to the aid of their country"
      GRAPHIC REDRAW
      SLEEP 3000
    
      GRAPHIC SET MIX %MIX_NOTXORSRC
      GRAPHIC LINE (200,200)-(600,500)
      GRAPHIC REDRAW
      SLEEP 4000
    
      GRAPHIC LINE (200,200)-(600,500)
      GRAPHIC REDRAW
    
      ' restore the default mode...
      GRAPHIC SET MIX %MIX_COPYSRC
    
      GRAPHIC SET FOCUS
      
      NewCaption = "Goodbye Friends"
      SetWindowText(hgWin, NewCaption)
                                      
      SLEEP 4000
    
      GRAPHIC WINDOW END
    
    END FUNCTION

    Leave a comment:


  • Rodney Hicks
    replied
    Could you show the code, or something compilable that you think would work but doesn't.
    If you are doing something wrong someone will find it, and/or if there is an issue it can be documented(sent to support).

    Leave a comment:


  • Doug Ingram
    replied
    I can't get this to work in a graphic window.

    I also tried CONSOLE NAME "My program"

    Thanks for any help!

    Leave a comment:


  • Steve Rossell
    replied
    Use
    Code:
    SetWindowText(hWin, szNewCaption)
    with szNewCaption being an Asciiz string.

    Leave a comment:


  • Mike Schneider
    started a topic Is there a way to change the caption

    Is there a way to change the caption

    Is there a way to change the caption of a graphics window...

    i.e. one creates a graphic window as such...

    GRAPHIC WINDOW "Box", 300, 300, 130, 130 TO hWin

    then later, as the program is running I want to change the word "Box" to
    the variable name$.

    Please advise...

    Thanks,

    Mike...
Working...
X