System Tray Icon - anyone got the latest app?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
14 messages Options
Reply | Threaded
Open this post in threaded view
|

System Tray Icon - anyone got the latest app?

Tim M
Looking in the newsgroup threads there are many references to an App that
makes Windows Tray icon services pretty easy. Unfortunately all the links
are broken? Someone asked a few months ago and that link is broken too.

Does anyone have a recent copy of that application - I believe it was called
TrayIcon.pac?

Also - maybe someone like Udo could put it on their website so its more readily
available?

Any help greatly appreciated.
Tim


Reply | Threaded
Open this post in threaded view
|

Re: System Tray Icon - anyone got the latest app?

Sebastián Sastre
Tim, I'm using this one...
regards,
Sebastian
PD: the mouse clicks are not being detected, if you can fix it I'll
have interest on the patch. Regards.
____________________________________
| package |
package := Package name: 'TaskbarIcons'.
package paxVersion: 1;
        basicComment: 'Copy this expression into a workspace and evalute it to
see the (rather boring) example in action. When you''ve finished close
the window and the tray icon should disappear too.

        TrayApplicationShell showOn: Locale.

Without the window...

        trayShell := TrayApplicationShell createOn: Presenter.
        trayShell exit.


'.

package basicScriptAt: #postuninstall put: ' "Remove the constants"
        Win32Constants
                removeKey: ''NIM_ADD'';
                removeKey: ''NIM_MODIFY'';
                removeKey: ''NIM_DELETE'';
                removeKey: ''NIF_MESSAGE'';
                removeKey: ''NIF_ICON'';
                removeKey: ''NIF_TIP''
'.
package basicScriptAt: #preinstall put: ' "Add the necessary constants"
        Win32Constants
                at: ''NIM_ADD'' put: 16r0;
                at: ''NIM_MODIFY'' put: 16r1;
                at: ''NIM_DELETE'' put: 16r2;
                at: ''NIF_MESSAGE'' put: 16r1;
                at: ''NIF_ICON'' put: 16r2;
                at: ''NIF_TIP'' put: 16r4'.

package classNames
        add: #NOTIFYICONDATA;
        add: #ShellNotifyView;
        add: #TrayApplicationShell;
        yourself.

package methodNames
        add: #ShellLibrary -> #shell_NotifyIcon:pnid:;
        yourself.

package binaryGlobalNames: (Set new
        yourself).

package globalAliases: (Set new
        yourself).

package setPrerequisites: (IdentitySet new
        add: '..\..\Object Arts\Dolphin\Base\Dolphin';
        add: '..\..\Object Arts\Dolphin\MVP\Base\Dolphin MVP Base';
        yourself).

package!

"Class Definitions"!

Win32Structure subclass: #NOTIFYICONDATA
        instanceVariableNames: ''
        classVariableNames: ''
        poolDictionaries: ''
        classInstanceVariableNames: ''!
Shell subclass: #TrayApplicationShell
        instanceVariableNames: 'tipText registerMessage'
        classVariableNames: ''
        poolDictionaries: ''
        classInstanceVariableNames: ''!
ShellView subclass: #ShellNotifyView
        instanceVariableNames: 'struct notifyMsg'
        classVariableNames: ''
        poolDictionaries: ''
        classInstanceVariableNames: ''!

"Global Aliases"!


"Loose Methods"!

!ShellLibrary methodsFor!

shell_NotifyIcon: dwMessage pnid: pnid
        "Add, modify, or delete an icon from the taskbar status area.
                WINSHELLAPI BOOL WINAPI Shell_NotifyIcon(
                        DWORD dwMessage, // message identifier
                        PNOTIFYICONDATA pnid // pointer to structure
                ); "

        <stdcall: bool Shell_NotifyIconA dword NOTIFYICONDATA* >
        ^self invalidCall! !
!ShellLibrary categoriesFor: #shell_NotifyIcon:pnid:!public!win32
functions-taskbar! !

"End of package definition"!

"Source Globals"!

"Classes"!

NOTIFYICONDATA guid: (GUID fromString:
'{9D51D1A9-0A75-43CD-8949-572558A9C983}')!
NOTIFYICONDATA comment: ''!
!NOTIFYICONDATA categoriesForClass!No category! !
!NOTIFYICONDATA methodsFor!

cbSize: anObject
        "Set the receiver's cbSize field to the value of anObject."

        bytes dwordAtOffset: 0 put: anObject!

dwSize: anObject
        "Set the receiver's dwSize field to the value of anObject."

        bytes dwordAtOffset: 0 put: anObject!

hIcon: anObject
        "Set the receiver's hIcon field to the value of anObject."

        bytes dwordAtOffset: 20 put: anObject!

hWnd: anObject
        "Set the receiver's hWnd field to the value of anObject."

        bytes dwordAtOffset: 4 put: anObject!

icon: anIconOrHandle
        "Set the receiver's hIcon field."

        self hIcon: anIconOrHandle asParameter.
        self uFlags: (self uFlags bitOr: NIF_ICON)!

initialize: anInteger
        "Private - Initialize the state of the receiver."

        super initialize: anInteger.
        self cbSize: anInteger!

message: anIntegerMessageNumber
        "Set the receiver's uCallbackMessage (message sent to window when
mouse over
        the icon in the taskbar) field."

        self uCallbackMessage: anIntegerMessageNumber.
        self uFlags: (self uFlags bitOr: NIF_MESSAGE)!

szTip
        "Answer the receiver's szTip field as a Smalltalk object."

        ^String fromAddress: (bytes yourAddress + 24)!

szTip: anObject
        "Set the receiver's szTip field to the value of anObject."

        | size |
        size := anObject byteSize - 1 min: (63 * 1).
        anObject replaceBytesOf: bytes from: 25 to: 24 + size startingAt: 1.
        bytes at: size+25 put: 0!

tipText: aString
        "Set the receiver's szTip (tip text) field."

        self szTip: aString.
        self uFlags: (self uFlags bitOr: NIF_TIP)!

uCallbackMessage: anObject
        "Set the receiver's uCallbackMessage field to the value of anObject."

        bytes dwordAtOffset: 16 put: anObject!

uFlags
        "Answer the receiver's uFlags field as a Smalltalk object."

        ^(bytes dwordAtOffset: 12)!

uFlags: anObject
        "Set the receiver's uFlags field to the value of anObject."

        bytes dwordAtOffset: 12 put: anObject!

uID: anObject
        "Set the receiver's uID field to the value of anObject."

        bytes dwordAtOffset: 8 put: anObject! !
!NOTIFYICONDATA categoriesFor: #cbSize:!**compiled accessors**!public!
!
!NOTIFYICONDATA categoriesFor: #dwSize:!**compiled accessors**!public!
!
!NOTIFYICONDATA categoriesFor: #hIcon:!**compiled accessors**!public! !
!NOTIFYICONDATA categoriesFor: #hWnd:!**compiled accessors**!public! !
!NOTIFYICONDATA categoriesFor: #icon:!accessing!public! !
!NOTIFYICONDATA categoriesFor: #initialize:!initializing!public! !
!NOTIFYICONDATA categoriesFor: #message:!accessing!public! !
!NOTIFYICONDATA categoriesFor: #szTip!**compiled accessors**!public! !
!NOTIFYICONDATA categoriesFor: #szTip:!**compiled accessors**!public! !
!NOTIFYICONDATA categoriesFor: #tipText:!accessing!public! !
!NOTIFYICONDATA categoriesFor: #uCallbackMessage:!**compiled
accessors**!public! !
!NOTIFYICONDATA categoriesFor: #uFlags!**compiled accessors**!public! !
!NOTIFYICONDATA categoriesFor: #uFlags:!**compiled accessors**!public!
!
!NOTIFYICONDATA categoriesFor: #uID:!**compiled accessors**!public! !

!NOTIFYICONDATA class methodsFor!

defineFields
        "Define the fields of the NOTIFYICONDATA 'structure'.

                NOTIFYICONDATA decompileDefinition;defineTemplate

                struct {
                        DWORD cbSize;
                        HWND hWnd;
                        UINT uID;
                        UINT uFlags;
                        UINT uCallbackMessage;
                        HICON hIcon;
                        char szTip[64];
                } NOTIFYICONDATA;
        "

        self
                defineField: #cbSize type: DWORDField writeOnly;
                defineField: #hWnd type: DWORDField writeOnly;
                defineField: #uID type: DWORDField writeOnly;
                defineField: #uFlags type: DWORDField new;
                defineField: #uCallbackMessage type: DWORDField writeOnly;
                defineField: #hIcon type: DWORDField writeOnly;
                defineField: #szTip type: (StringField length: 64)!

initialize
        "TEMPORARY initialize method
                NOTIFYICONDATA initialize
        "

        Win32Constants
                at: 'NIM_ADD' put: 16r0;
                at: 'NIM_MODIFY' put: 16r1;
                at: 'NIM_DELETE' put: 16r2;
                at: 'NIF_MESSAGE' put: 16r1;
                at: 'NIF_ICON' put: 16r2;
                at: 'NIF_TIP' put: 16r4
! !
!NOTIFYICONDATA class categoriesFor: #defineFields!initializing!public!
!
!NOTIFYICONDATA class categoriesFor: #initialize!initializing!public! !

TrayApplicationShell guid: (GUID fromString:
'{D3F70398-A836-4813-80AD-BEB4363BC3A2}')!
TrayApplicationShell comment: ''!
!TrayApplicationShell categoriesForClass!Unclassified! !
!TrayApplicationShell methodsFor!

createSchematicWiring
        super createSchematicWiring.
        self
                when: #rightButtonReleased:
                send: #onRightButtonReleased:
                to: self!

icon
        ^ model icon!

onCursorAtTray

!

onRightButtonReleased: anObject

        Transcript nextPutAll: TimeStamp current printShort ;cr.
!

onViewClosed

        super onViewClosed.

        self view unregister.!

onViewOpened

        | struct notifyMsg |

        super onViewOpened.

        self view struct: self struct.
        self view notifyMsg: notifyMsg.
        self view register.!

registerMessage

        registerMessage isNil ifTrue:[ registerMessage := 'A tray icon
application powered by Dolphin Smalltalk'].
        ^registerMessage!

registerMessage: anObject
        registerMessage := anObject!

struct

        |struct notifyMsg |

        ^ struct :=  NOTIFYICONDATA new.
        notifyMsg := self view registerMessage: self registerMessage.
        struct
                uID: 1;
                icon: self icon;
                message: notifyMsg;
                tipText: self tipText.!

tipText
        tipText isNil ifTrue:[ tipText  := 'A default tip text.'].
        ^tipText!

tipText: anObject
        tipText := anObject! !
!TrayApplicationShell categoriesFor:
#createSchematicWiring!initializing!private! !
!TrayApplicationShell categoriesFor: #icon!public! !
!TrayApplicationShell categoriesFor: #onCursorAtTray!public! !
!TrayApplicationShell categoriesFor: #onRightButtonReleased:!public! !
!TrayApplicationShell categoriesFor: #onViewClosed!public! !
!TrayApplicationShell categoriesFor: #onViewOpened!public! !
!TrayApplicationShell categoriesFor:
#registerMessage!accessing!private! !
!TrayApplicationShell categoriesFor:
#registerMessage:!accessing!private! !
!TrayApplicationShell categoriesFor: #struct!private! !
!TrayApplicationShell categoriesFor: #tipText!accessing!private! !
!TrayApplicationShell categoriesFor: #tipText:!accessing!private! !

!TrayApplicationShell class methodsFor!

resource_Default_view
        "Answer the literal data from which the 'Default view' resource can be
reconstituted.
        DO NOT EDIT OR RECATEGORIZE THIS METHOD.

        If you wish to modify this resource evaluate:
        ViewComposer openOn: (ResourceIdentifier class: self selector:
#resource_Default_view)
        "

        ^#(#'!!STL' 3 788558 10 ##(Smalltalk.STBViewProxy)  8
##(Smalltalk.ShellNotifyView)  98 29 0 0 98 2 27131905 131073 416 0
524550 ##(Smalltalk.ColorRef)  8 4278190080 0 5 0 0 0 416 0 234 256 98
0 0 0 0 0 0 1 0 0 0 0 1 0 0 917766 ##(Smalltalk.NOTIFYICONDATA)  8 #[88
0 0 0 0 0 0 0 1 0 0 0 7 0 0 0 156 193 0 0 13 2 12 0 68 111 108 112 104
105 110 32 83 109 97 108 108 116 97 108 107 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]
99129 983302 ##(Smalltalk.MessageSequence)  202 208 98 2 721670
##(Smalltalk.MessageSend)  8 #createAt:extent: 98 2 328198
##(Smalltalk.Point)  89 117 738 1021 561 416 674 8 #updateMenuBar 544
416 983302 ##(Smalltalk.WINDOWPLACEMENT)  8 #[44 0 0 0 0 0 0 0 0 0 0 0
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 44 0 0
0 58 0 0 0 42 2 0 0 82 1 0 0] 98 0 738 193 193 0 27 )! !
!TrayApplicationShell class categoriesFor:
#resource_Default_view!public!resources-views! !

ShellNotifyView guid: (GUID fromString:
'{3328B4F9-D699-4A8D-BA31-0C16D8F1B1FB}')!
ShellNotifyView comment: ''!
!ShellNotifyView categoriesForClass!No category! !
!ShellNotifyView methodsFor!

dispatchRegistered: registeredId wParam: wParam lParam: lParam
        "Private - Dispatch the registered message which was sent to the
receiver.
        To be overridden by subclasses which implement registered messages in
an appropriate
        manner (e.g. by a secondary message map, or, if few in number, by
conditional tests)"

        | canvas |

        ^registeredId = notifyMsg
                ifTrue:[self presenter onCursorAtTray]
                ifFalse:[ super dispatchRegistered: registeredId wParam: wParam
lParam: lParam]

" ^registeredId = notifyMsg
                ifTrue: [
                        self canvas
                                text: Cursor position printString
                                at: 10@10;
                                free.
                        Sound bell]"!

notifyMsg
        ^notifyMsg!

notifyMsg: anObject
        notifyMsg := anObject!

onDestroyed

        self unregister.
        ^super onDestroyed
!

register
        struct hWnd: self asParameter.
        ^ShellLibrary default shell_NotifyIcon: NIM_ADD pnid: struct
!

registerMessage: aString

        ^ self class registerMessage: aString
!

struct
        ^struct!

struct: anObject
        struct := anObject!

unregister
        ^ShellLibrary default shell_NotifyIcon: NIM_DELETE pnid: struct.
! !
!ShellNotifyView categoriesFor: #dispatchRegistered:wParam:lParam:!must
not strip!public! !
!ShellNotifyView categoriesFor: #notifyMsg!accessing!private! !
!ShellNotifyView categoriesFor: #notifyMsg:!accessing!must not
strip!private! !
!ShellNotifyView categoriesFor: #onDestroyed!public! !
!ShellNotifyView categoriesFor: #register!must not strip!public! !
!ShellNotifyView categoriesFor: #registerMessage:!must not
strip!public! !
!ShellNotifyView categoriesFor: #struct!accessing!private! !
!ShellNotifyView categoriesFor: #struct:!accessing!must not
strip!private! !
!ShellNotifyView categoriesFor: #unregister!public! !

!ShellNotifyView class methodsFor!

example
        "Example usage of this example class
                ShellNotifyView example
        "
        | inst struct notifyMsg |

        inst := self new.
        struct := NOTIFYICONDATA new.
        notifyMsg := self registerMessage: 'Dolphin Shell Notification'.
        struct
                uID: 1;
                icon: Transcript icon;
                message: notifyMsg;
                tipText: 'Dolphin Smalltalk'.
        inst create show register.!

example2
        "Example usage of this example class
                ShellNotifyView example
        "

        ^ self new create register; yourself!

registerMessage: aString
        "Register a named window message, answering the message id to use."

        ^UserLibrary default registerWindowMessage: aString! !
!ShellNotifyView class categoriesFor: #example!public! !
!ShellNotifyView class categoriesFor: #example2!public! !
!ShellNotifyView class categoriesFor:
#registerMessage:!dispatching!public! !

"Binary Globals"!


Reply | Threaded
Open this post in threaded view
|

Re: System Tray Icon - anyone got the latest app?

Martin Rubi
In reply to this post by Tim M
Hi Tim.
In http://mrubi.users.dolphinmap.net/Martin%20Rubi%20goodies.zip
there is a package called 'mr ntServiceMonitor.pac'. I don't know if that's
what you are looking for, but I hope it helps.

best regards
martin

"Tim M" <[hidden email]> escribió en el mensaje
news:[hidden email]...

> Looking in the newsgroup threads there are many references to an App that
> makes Windows Tray icon services pretty easy. Unfortunately all the links
> are broken? Someone asked a few months ago and that link is broken too.
>
> Does anyone have a recent copy of that application - I believe it was
> called TrayIcon.pac?
>
> Also - maybe someone like Udo could put it on their website so its more
> readily available?
>
> Any help greatly appreciated.
> Tim
>
>


Reply | Threaded
Open this post in threaded view
|

Re: System Tray Icon - anyone got the latest app?

Chris Uppal-3
In reply to this post by Sebastián Sastre
Tim, Sebastián wrote:

> PD: the mouse clicks are not being detected, if you can fix it I'll
> have interest on the patch.

I have two versions of the same package, either or both or neither may be
newer.  The older of the two has package comment:

===========
    Copy this expression into a workspace and evalute it to see the (rather
boring) example in action. When you've finished close the window and the tray
icon should disappear too.

 ShellNotifyView show
===========

The second has the same comment except that the example reads:

    ShellNotifyView example

Does anyone know which of the three is most recent ?

Also, I wanted to mention the other package, "TaskbarIcon" by Mark Nijdam.
That takes a different approach: instead of subclassing Shell (which is
inflexible) it creates a new kind of View.  It also has click and context-menu
handling build-in.  I'm currently using it (or rather a version with a few
fixes of my own) and it is working well so far.

If anyone (Udo?) wants a copy then please drop me a line.  Note that my version
is for D5, I think it would require a few changes for D6 since some of the
stuff it provides is now built in to D6.

I also have a little package which extends it to provide "typical" task-bar
icon management more-or-less automatically.  Again, available on request and
with the same proviso.

    -- chris


Reply | Threaded
Open this post in threaded view
|

Re: System Tray Icon - anyone got the latest app?

Tim M
In reply to this post by Sebastián Sastre
Hi Sebastián/Martin,

Thanks to you both - my floating window on my little utility has been bugging
me for a while - I'll give them a spin and find out which works.

Tim


Reply | Threaded
Open this post in threaded view
|

Re: System Tray Icon - anyone got the latest app?

Sebastián Sastre
In reply to this post by Chris Uppal-3
Chris, I do want one of these with take care of context button clicks
cheers,
Sebastian

Chris Uppal escreveu:

> Tim, Sebastián wrote:
>
> > PD: the mouse clicks are not being detected, if you can fix it I'll
> > have interest on the patch.
>
> I have two versions of the same package, either or both or neither may be
> newer.  The older of the two has package comment:
>
> ===========
>     Copy this expression into a workspace and evalute it to see the (rather
> boring) example in action. When you've finished close the window and the tray
> icon should disappear too.
>
>  ShellNotifyView show
> ===========
>
> The second has the same comment except that the example reads:
>
>     ShellNotifyView example
>
> Does anyone know which of the three is most recent ?
>
> Also, I wanted to mention the other package, "TaskbarIcon" by Mark Nijdam.
> That takes a different approach: instead of subclassing Shell (which is
> inflexible) it creates a new kind of View.  It also has click and context-menu
> handling build-in.  I'm currently using it (or rather a version with a few
> fixes of my own) and it is working well so far.
>
> If anyone (Udo?) wants a copy then please drop me a line.  Note that my version
> is for D5, I think it would require a few changes for D6 since some of the
> stuff it provides is now built in to D6.
>
> I also have a little package which extends it to provide "typical" task-bar
> icon management more-or-less automatically.  Again, available on request and
> with the same proviso.
>
>     -- chris


Reply | Threaded
Open this post in threaded view
|

Re: System Tray Icon - anyone got the latest app?

Chris Uppal-3
Sebastián,

> Chris, I do want one of these with take care of context button clicks
> cheers,

Sent...

    -- chris


Reply | Threaded
Open this post in threaded view
|

Re: System Tray Icon - anyone got the latest app?

Federico.Omoto
In reply to this post by Sebastián Sastre
Chris, same as Sebastián please...

Thank you in advance!


Reply | Threaded
Open this post in threaded view
|

Re: System Tray Icon - anyone got the latest app?

Chris Uppal-3
Fede,

> Chris, same as Sebastián please...

Sent....

    `-- chris


Reply | Threaded
Open this post in threaded view
|

Re: System Tray Icon - anyone got the latest app?

Esteban A. Maringolo
Chris:

Chris Uppal escribió:
> Fede,
>
>> Chris, same as Sebastián please...
>
> Sent....

Would you care to place it on www.dolphinmap.net?

Until we have a centralized repository, DM could be a centralized place
to search.

Thank you!

--
Regards.


Reply | Threaded
Open this post in threaded view
|

Re: System Tray Icon - anyone got the latest app?

Chris Uppal-3
Esteban,

> Would you care to place it on www.dolphinmap.net?

Happy to, if Udo wants it (I can imagine that he /might/ be a bit reluctant to
host a package without a clear licence saying what sort of redistibution is
permitted).

Also, I'm not sure where it should go (even if I were confortable with wikis --
which I'm not); there doesn't seem to be a "goodies" section for dolphinmap
itself (maybe that's just a temporary consequence of the problems Udo
mentioned).

    -- chris


Reply | Threaded
Open this post in threaded view
|

Re: System Tray Icon - anyone got the latest app?

Udo Schneider
Chris Uppal wrote:
> Happy to, if Udo wants it (I can imagine that he /might/ be a bit reluctant to
> host a package without a clear licence saying what sort of redistibution is
> permitted).
No, that's fine with me. The only thing that might be a showstopper is
the license. The wiki itself has a license which might collide with your
(non-existing) license.

> Also, I'm not sure where it should go (even if I were confortable with wikis --
> which I'm not); there doesn't seem to be a "goodies" section for dolphinmap
> itself (maybe that's just a temporary consequence of the problems Udo
> mentioned).
As mentioned above you can either put it on the wiki or I can create a
an account for you which would be reachable under
YourName.users.dolphinmap.net. This would be a regular webspace account
and you can upload anything you want in any form you want.

CU,

Udo


Reply | Threaded
Open this post in threaded view
|

Re: System Tray Icon - anyone got the latest app?

Chris Uppal-3
Udo,

> > Also, I'm not sure where it should go (even if I were confortable with
> > wikis -- which I'm not); there doesn't seem to be a "goodies" section
> > for dolphinmap itself (maybe that's just a temporary consequence of the
> > problems Udo mentioned).
> As mentioned above you can either put it on the wiki or I can create a
> an account for you which would be reachable under
> YourName.users.dolphinmap.net. This would be a regular webspace account
> and you can upload anything you want in any form you want.

I'd rather not associate this directly with /me/ -- after all I didn't write
the software and have nothing to do with it except use it (and add one small
bugfix...).

Perhaps -- if you like the idea -- this would be a good time to start setting
up a kind of "orphanage" for packages who's owners have departed (may they rest
in peace), but whose code still needs a place to live ?

If so then I have a few oldish packages which fit that category: I'd be happy
to dig them out and write a paragraph or two of text to go with them if you
(and the others) feel that's a sensible thing to do.

    -- chris

(P.S.  Funny how everything "communal" always gets so /complicated/...)


Reply | Threaded
Open this post in threaded view
|

Re: System Tray Icon - anyone got the latest app?

Tim M
> Perhaps -- if you like the idea -- this would be a good time to start
> setting up a kind of "orphanage" for packages who's owners have
> departed (may they rest in peace), but whose code still needs a place
> to live ?


+1

I am still toying with the idea of setting up a subversion repository with
some additional Dolphin code to access it kind of like Store or SqueakMap.
But for now, at least having a web resting place to avoid all of the email
back and forth would be a big asset. Its frustrating if you read about some
solution that got mailed to someone and then you have to impose on them to
get it mailed to you as well.

Tim