Page 1 of 1

TrayIcon (OOP)

Posted: Sat Apr 17, 2010 12:17 am
by luis
; TrayIcon class 1.00 (Windows)
; April 2010
; Written by Luis with PB 4.41

; A Traybar Icon implementation for PureBasic (OOP)

; The "main" icon is always set with TrayIcon_Create() or with SetIcon()

; The icons used in the animations are "secondary" icons and when the animation stops
; the icon in the tray bar reverts to the "main" icon.

; The icons are never copied internally to the object. TrayIcon always reference the icons
; defined in your program, so don't free them while they're in use.

; The "helper" procedure TrayIcon_GetIconFromRGBA() can be used to convert an RGBA
; PureBasic's image to icon format. This can be useful to draw an icon at runtime using the
; PB drawings commands and than convert the image into an icon to be used with a TrayIcon object.
; See the sample program for more info about it.

; The code should be Ascii and Unicode compatible.
; The code should be 32 and 64 bit compatible.

Code: Select all

Interface TrayIcon
 
 ; destroy the tray icon and free the object
 Destroy()
 
 ; set the text tooltip for the icon
 SetTooltip (sText.s)
 
 ; show a balloon tooltip with title, text and optionally a system defined icon
 ShowBalloon (sTitle.s, sText.s, iIconType = #TRAY_ICON_NONE)
 
 ; remove the text tooltip
 RemoveTooltip()
 
 ; remove the balloon tooltip
 RemoveBalloon() 
 
 ; change the icon 
 ; ignored if animation is active
 SetIcon (hIcon)
 
 ; enable / disable the blinking of the icon
 ; ignored if animation is active
 Blink (flgStatus)
 
 ; set the number of frames to be used to animate the icon
 ; ignored if animation is active
 SetAnimationFrames (iFrames)
 
 ; set the time to wait in ms. between each frame
 ; ignored if animation is active
 SetAnimationDelay (iDelay)
 
 ; load the specified icon in a frame slot (0 based)
 ; ignored if animation is active
 LoadFrameIcon (iFrame, hIcon)
 
 ; start the animation and play it forever (-1) or n times (1...n)
 ; disable blinking if is active
 StartAnimation (iCycles)
 
 ; stop the animation and discard the animation data freeing memory
 StopAnimation()
 
 ; hide/show the icon in the tray keeping all the states active
 Hide (flgStatus)
 
 ; return 0/1 if blinking is inactive/active
 IsBlinking()
 
 ; return 0/1 if animation is inactive/active
 IsAnimated()
 
 ; return 0/1 if the tray icon is visible/hidden
 IsHidden()
 
EndInterface
Download [... from someone who got a copy at the time].

Bye :wink:

Re: TrayIcon (OOP)

Posted: Sat Apr 17, 2010 12:57 am
by ts-soft
thx, Image

Re: TrayIcon (OOP)

Posted: Mon Apr 26, 2010 9:19 pm
by omboy
Image

Re: TrayIcon (OOP)

Posted: Mon Apr 26, 2010 9:58 pm
by Kiffi
luis wrote:; A Traybar Icon implementation for PureBasic (OOP)
Thanks for sharing! Image

Greetings ... Kiffi

Re: TrayIcon (OOP)

Posted: Thu May 24, 2012 1:43 pm
by Phantomas
Very nice code!
But, how I can move code "Show balloon + icon" to new, clean project? Need only this function.

Re: TrayIcon (OOP)

Posted: Thu May 24, 2012 2:56 pm
by Kwai chang caine
Great !!!
Thanks for sharing 8)

Re: TrayIcon (OOP)

Posted: Thu May 24, 2012 6:30 pm
by Falko
Cool.

Thx

Re: TrayIcon (OOP)

Posted: Thu May 24, 2012 6:43 pm
by ts-soft
@Kwaï chang caïne @Falco

2 years sleep? :lol:

Re: TrayIcon (OOP)

Posted: Thu May 24, 2012 7:06 pm
by Falko
So it's :shock:
:mrgreen:

Re: TrayIcon (OOP)

Posted: Fri May 25, 2012 8:01 am
by Kwai chang caine
ts-soft wrote:@Kwaï chang caïne @Falco
2 years sleep? :lol:
Ooooohhh !!!! not see that :oops:

It's the fault at Image :lol: :lol:

Often, a member put a question several years after, and the others members continue in a single file like Image :lol: :lol: :lol:

After all, thanks to that, this thread live in a second life :mrgreen:

And thanks to Image i see this code i never see before 8)

Re: TrayIcon (OOP)

Posted: Fri May 25, 2012 10:38 am
by A M S
very nice :D

Re: TrayIcon (OOP)

Posted: Fri May 25, 2012 6:34 pm
by luis
And please note the download link still works after two years, like it should be in a perfect world :wink:

Re: TrayIcon (OOP)

Posted: Sat May 26, 2012 2:37 am
by RichAlgeni
WoW! Thanks Luis!