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

Icon tray menus

From: Dr. Roger Dube <rogerdube_at_dathq.com>
Date: Sat, 12 Aug 2006 17:49:52 -0400

Does anyone have a sample of creating a tray icon for a turnkey with a menu
of actions? Example: LAN connection tray icon – when you click on it, you
see a list of menu options that you can select, such as Disable, Status,
Repair etc.

I have see the trayicon.f file as a sample for creating such an icon, but it
basically gives a single information item which appears when the mouse
hovers over it… I was looking for something more elaborate.

The trayicon.f code is below:

Thanks!

- Roger

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" key.ico"

CREATE TIPTEXT ( TEXT THAT APPEARS WHEN MOUSE HOVERS OVER ICON )

   ,Z" Myapplication is active"

\ use at main initdialog or WM_CREATE

\ GOES TO TASKBAR RT SIDE BUNCH OF ICONS

: TASKICON ( ZTIP -> - )

    TipText 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 ;

    \ *****************************************************

--------------------------------------------
Dr. Roger Dube
President and Chief Scientist
Digital Authentication Technologies, Inc.
HYPERLINK "http://www.dathq.com/"http://www.datHQ.com

1900 Glades Road
Suite 441
Boca Raton, FL 33431-7333

phone: 561.392.7404

cell: 561.859.4283
eFax : 561.892.2474
email: rogerdubeHYPERLINK "mailto:rogerdube_at_datHQ.com"@datHQ.com

--------------------------------------------------------
This email message is for the sole use of the intended recipient(s) and may
contain confidential and privileged information. Any unauthorized review,
use, disclosure or distribution is prohibited. If you are not the intended
recipient, please contact the sender by reply email and destroy all copies
of the original message. Any views expressed in this message are those of
the individual sender, except where the sender specifically states them to
be the views of Digital Authentication Technologies, Inc.

--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.405 / Virus Database: 268.10.9/417 - Release Date: 8/11/2006
----------------------------------------------------------------------
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 Aug 12 2006 - 14:50:33 PDT

This archive was generated by hypermail 2.2.0 : Wed Nov 19 2008 - 03:04:27 PST