New UserLib : NotifyIcon library

Windows specific forum
User avatar
Flype
Addict
Addict
Posts: 1542
Joined: Tue Jul 22, 2003 5:02 pm
Location: In a long distant galaxy

New UserLib : NotifyIcon library

Post by Flype »

Code: Select all

------------------------------------------------------------
- Object:   NotifyIcon UserLibrary / SHELL_NOTIFYICON
-           
- Descr:    Set of functions for the Systray Icon
-           From the 'shellapi.h' Microsoft include file
-           
- Version:  1.0 Beta
- Date:     Mars 2005
-           
- Compil:   Compiled with Purebasic 3.93
-           Maded with TailBite 1.2 Beta 2.3
-           
- Author:   Philippe 'Flype' Carpentier
- Email:    flype@altern.org
------------------------------------------------------------

------------------------------------------------------------
**** WARNING - PLEASE READ FOLLOWING NOTES ****
------------------------------------------------------------

The help file is UNDER CONSTRUCTION.

Please, refers to the purebasic example file provided
in the archive to understand how to use this UserLibrary.

This library extends the SysTray functions set of Purebasic.
But not only for Window95+. It allows to use new functionnalities
of Windows 2000, Windows XP, and the XP SP2 features.

------------------------------------------------------------
FUNCTIONS FOR THE NOTIFYICON API
------------------------------------------------------------

Result.l = ni_Add(uID.l, tip.s, hIcon.l)
Result.l = ni_Remove(uID.l)

Result.l = ni_Hide(uID.l)
Result.l = ni_Show(uID.l)
Result.l = ni_Focus(uID.l)
Result.l = ni_Icon(uID.l, hIcon.l)

------------------------------------------------------------
TOOLTIP AND BALLOON ( CARTOON STYLE ) FUNCTIONS
------------------------------------------------------------

Result.l = ni_Tip(uID.l, tip.s)
Result.l = ni_Info(uID.l, title.s, info.s, Flags.l)

------------------------------------------------------------
FUNCTIONS FOR LOADING ICONS OR USING EXISTING ONES
MAKING LIFE A LITTLE BIT EASIER...
------------------------------------------------------------

hIcon.l = ni_LoadIcon(IconFileName.s)
hIcon.l = ni_ExtractIcon()
hIcon.l = ni_DefaultIcon()

hIcon.l = ni_IconWinLogo()
hIcon.l = ni_IconQuestion()
hIcon.l = ni_IconHand()
hIcon.l = ni_IconExclamation()
hIcon.l = ni_IconAsterix()
hIcon.l = ni_IconApplication()
You can download it here : NotifyIcon_UserLib.zip

The source code is provided in the archive, making it easier to recompile with TailBite if needed.
Also, it could be a good tutorial on how to use the very new features of Windows 2000 to XP SP2.

Best Regards
No programming language is perfect. There is not even a single best language.
There are only languages well suited or perhaps poorly suited for particular purposes. Herbert Mayer
P-J
User
User
Posts: 44
Joined: Fri Jan 23, 2004 6:54 pm
Contact:

Post by P-J »

Nice one!

What does this library offer that the existing PB system tray stuff doesn't?
dagcrack
Addict
Addict
Posts: 1868
Joined: Sun Mar 07, 2004 8:47 am
Location: Argentina
Contact:

Post by dagcrack »

Well is there any updated lib for the win32 api and such?

"
ProcedureReturn Shell_NotifyIcon_(#NIM_MODIFY,@ni)
"

Getting error, cant find the function ?
User avatar
Flype
Addict
Addict
Posts: 1542
Joined: Tue Jul 22, 2003 5:02 pm
Location: In a long distant galaxy

Post by Flype »

@P-J
mainly the " Result.l = ni_Info(uID.l, title.s, info.s, Flags.l) " function offer the ability to display this kind of balloon tooltip, specially on windows XP
... Image

also there are some new functions, not included natively in Purebasic
Result.l = ni_Hide(uID.l)
Result.l = ni_Show(uID.l)
Result.l = ni_Focus(uID.l)


@dagcrack
no - don't think so... i compiled it using PB3.93 and last version of TailBite, no more. maybe it's because you have win98 ? i tried to make it as compatible as possible, so...
No programming language is perfect. There is not even a single best language.
There are only languages well suited or perhaps poorly suited for particular purposes. Herbert Mayer
El_Choni
TailBite Expert
TailBite Expert
Posts: 1007
Joined: Fri Apr 25, 2003 6:09 pm
Location: Spain

Post by El_Choni »

@dagcrack: can you specify the error a little bit? Thx, regards,
El_Choni
dagcrack
Addict
Addict
Posts: 1868
Joined: Sun Mar 07, 2004 8:47 am
Location: Argentina
Contact:

Post by dagcrack »

it just cant find the function
maybe I got oldie libs
User avatar
NoahPhense
Addict
Addict
Posts: 1999
Joined: Thu Oct 16, 2003 8:30 pm
Location: North Florida

Post by NoahPhense »

Very kewl Flype... nice Lib..

- np
Pantcho!!
Enthusiast
Enthusiast
Posts: 538
Joined: Tue Feb 24, 2004 3:43 am
Location: Israel
Contact:

Post by Pantcho!! »

:roll: how do you manage to control it with addsystray to a popupmenu?!

*edit* - the lib should have a help file, its a great lib!
but the main problem is in the txt help file you dont mention there is a MyWindowCallBack that need to be called.

great lib looking forward for the help file with more examples. :o
Killswitch
Enthusiast
Enthusiast
Posts: 731
Joined: Wed Apr 21, 2004 7:12 pm

Post by Killswitch »

On my computer (XP Pro) i've found a bug. If I use one of the ballon commands I have to remove the existing icon then add a new one before I can use another ballon.
~I see one problem with your reasoning: the fact is thats not a chicken~
User avatar
GeoTrail
Addict
Addict
Posts: 2794
Joined: Fri Feb 13, 2004 12:45 am
Location: Bergen, Norway
Contact:

Post by GeoTrail »

Very nice lib, I like it :)
I Stepped On A Cornflake!!! Now I'm A Cereal Killer!
Pantcho!!
Enthusiast
Enthusiast
Posts: 538
Joined: Tue Feb 24, 2004 3:43 am
Location: Israel
Contact:

Post by Pantcho!! »

Killswitch wrote:On my computer (XP Pro) i've found a bug. If I use one of the ballon commands I have to remove the existing icon then add a new one before I can use another ballon.
what do you mean?

if you mean that while the ballon is open and you want to send another ballon instead of that for me it works good. as long as its the same baloon ID number.
Killswitch
Enthusiast
Enthusiast
Posts: 731
Joined: Wed Apr 21, 2004 7:12 pm

Post by Killswitch »

Let me be clearer. With the example that comes with the library I add an icon to the systray then try a balloon, it works fine. I close the balloon with the X button in it. If I then try to open a new ballon of the same type, or a new one it won't work unless I remove that icon, then add another. I have to repeat this in order to get it to work.
~I see one problem with your reasoning: the fact is thats not a chicken~
User avatar
Flype
Addict
Addict
Posts: 1542
Joined: Tue Jul 22, 2003 5:02 pm
Location: In a long distant galaxy

Post by Flype »

hummm, interessant bug...
this mean that i must come back in the source again.
i didn't change it since last upload. and sorry for being late.
:roll:
No programming language is perfect. There is not even a single best language.
There are only languages well suited or perhaps poorly suited for particular purposes. Herbert Mayer
Blade
Enthusiast
Enthusiast
Posts: 362
Joined: Wed Aug 06, 2003 2:49 pm
Location: Venice - Italy, Japan when possible.
Contact:

Post by Blade »

How can I handle the #PB_Event_SysTray events to use a pop-up menu with the systray icon, using this lib?
Can't it be compatible with Pure's AddSysTrayIcon ?
Intrigued
Enthusiast
Enthusiast
Posts: 501
Joined: Thu Jun 02, 2005 3:55 am
Location: U.S.A.

Post by Intrigued »

Blade wrote:How can I handle the #PB_Event_SysTray events to use a pop-up menu with the systray icon, using this lib?
Can't it be compatible with Pure's AddSysTrayIcon ?
I am also wondering how to create an 'options' menu for a SysTray icon. It needs to work on 98SE and newer M.S. OSes. Ideas?

Thanks,
Intrigued - Registered PureBasic, lifetime updates user
Post Reply