programming tools for Windows applications development
  Home  |   SwiftForth Archive  |   SwiftX Archive  |

Re: icon on toolbar for a task

From: <wheath_at_comcast.net>
Date: Sun, 07 May 2006 00:01:55 +0000

Roger,
Try this.
I didn't get your window to open - but the icon does appear
 2 Import: Shell_NotifyIcon ( msg Adata -> 0fail )
 6 Import: LoadImage ( HINST ZICON FLG WID HT FLG ->0fail )

Class tagnotifyicon
  VARIABLE notsz
  VARIABLE hwnd
  VARIABLE uid
  VARIABLE flags
  VARIABLE callback \ FOR RIGHT CLICK MENU - NOT USED HERE = NULL
  VARIABLE hicon
64 BUFFER: tip
End-Class

tagnotifyicon builds Notifyicondata
tagnotifyicon sizeof Notifyicondata notsz ! \ once

1000 CONSTANT ICTASK ( TASK BAR ICON ID )
CREATE ICON$ ( ICON FILE NAME WITH PATH )
   ,Z" C:\YOURPATH\YOURICON.ICO"

CREATE TIPTEXT ( TEXT THAT APPEARS WHEN MOUSE HOVERS OVER ICON )
   ,Z" Your Tip Text"

\ use at main initdialog or WM_CREATE
\ GOES TO TASKBAR RT SIDE BUNCH OF ICONS
: TASKICON ( ZTIP -> - )
    ZCOUNT Notifyicondata tip zplace ( - )
    NIF_ICON NIF_TIP OR Notifyicondata flags ! \ TIP WORKS
    HWND Notifyicondata hwnd ! \ REQD OR DISAPPEARS WHEN CURSOR TOUCHES
    ICTASK Notifyicondata uid !
    NULL ICON$ IMAGE_ICON 0 0
    LR_DEFAULTCOLOR LR_DEFAULTSIZE LR_LOADFROMFILE OR OR
    LoadImage Notifyicondata hicon ! \ WORKS
    NIM_ADD Notifyicondata ADDR Shell_NotifyIcon DROP ;

\ use at close main
\ ICON WILL REMAIN IF PGM BOMBS
: DELTASKICON ( - )
    NIM_DELETE Notifyicondata ADDR Shell_NotifyIcon DROP ;
\ *****************************************************

\ Roger's Code
: TURNKEYFUNCTION
    TIPTEXT TASKICON ; \ Put turnkey word here.

CREATE AppName ,Z" Turnkey"

[SWITCH TURNKEY-MESSAGES DEFWINPROC ( -- res )
   WM_DESTROY RUN:
     DELTASKICON
     0 PostQuitMessage DROP 0 ;
SWITCH]
:NONAME MSG LOWORD TURNKEY-MESSAGES ; 4 CB: TURNPROC

Warren Heath
wheath_at_comcast.net

-------------- Original message --------------
From: "Dr. Roger Dube" <rogerdube_at_dathq.com>

> Does anyone know how to add an icon to the task toolbar (at the bottom of
> the Windows screen) for a turnkey that we create using SwiftForth? > ----------------------------------------------------------------------

----------------------------------------------------------------------
sftalk_at_forth.com The SwiftForth programming discussion email list
To unsubscribe, send subject "unsubscribe" to sftalk-request_at_forth.com
For list command help, send subject "help" to sftalk-request_at_forth.com
Message archives are located at http://www.forth.com/archive/sftalk
----------------------------------------------------------------------
This list is a forum for SwiftForth users. For product support and bug
reports, please send email to support_at_forth.com
----------------------------------------------------------------------
Received on Sat May 06 2006 - 17:02:37 PDT

This archive was generated by hypermail 2.2.0 : Wed Jan 07 2009 - 03:04:16 PST