Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / System Tray function that doesn't rely on 3rd Party DLL

Author
Message
Burning Feet Man
16
Years of Service
User Offline
Joined: 4th Jan 2008
Location: Sydney, Australia
Posted: 20th Jun 2013 01:16
I've started researching into System Tray Icons. The only examples that I can find on these forums rely on a 3rd party DLL that has to be packaged with the final executable.

Does anyone know of, or has anyone written an example DBPro program that interacts with the Windows 7 system tray when the application is minimized?

Once again, I've been trawling through User32.DLL & System32.DLL functions, and I think there's something there... Are there other Windows DLL files that are worth researching?

Help build an online DarkBASIC Professional help archive.
DarkBasic Help Wikia
Rudolpho
18
Years of Service
User Offline
Joined: 28th Dec 2005
Location: Sweden
Posted: 22nd Jun 2013 23:52
I think it's possible, but you'd have to think a bit outside the box to do it.
I'll try writing something together tomorrow, but no guarantees (I just think I know how it might be done, have never done it).


"Why do programmers get Halloween and Christmas mixed up?"
Burning Feet Man
16
Years of Service
User Offline
Joined: 4th Jan 2008
Location: Sydney, Australia
Posted: 23rd Jun 2013 06:34 Edited at: 23rd Jun 2013 06:53
I think it's possible too. I'm going to take a break from my current project and read up more here;

http://msdn.microsoft.com/en-us/library/windows/desktop/ee330740%28v=vs.85%29.aspx

Notifications and the Notification Area

Quote: "The notification area is a portion of the taskbar that provides a temporary source for notifications and status. It can also be used to display icons for system and program features that have no presence on the desktop, such as battery level, volume control, and network status. The notification area has been known historically as the system tray or status area."


It's no wonder I was having so much trouble tracking down examples, I was busy Googling "System Tray" & "Systray", not realising that it's now referred to as the "Notification Area".

Help build an online DarkBASIC Professional help archive.
DarkBasic Help Wikia
Mobiius
Valued Member
21
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 23rd Jun 2013 14:44
That's Microsoft's inconsistent naming conventions for you!

Windows: 3, 98, ME/2000, XP, Vista, 7, 8
Xbox: Xbox, 360, One
Mobile OS: CE, Pocket PC 2000, PPC 2002, Windows Mobile 2003, WM2003SE, WM5, WM6, Windows Phone 7, WP8
Word: Winword, Word 2, Word 6, Word 95, Word 97, Word 98, Word 2000, Word 2002, Word 2003, Word 2007, Word 2010, Word 2013

And so on. lol

This is my current project, check it out! [href]forum.thegamecreators.com/?m=forum_view&t=204576&b=8[/href]
This is my website, check it out! [href]http:\\www.TeamDefiant.co.uk[/href]
Rudolpho
18
Years of Service
User Offline
Joined: 28th Dec 2005
Location: Sweden
Posted: 23rd Jun 2013 14:49
Well, here's a starting point.
Running this will display the icon in the system tray and you will see its tooltip by holding your cursor over it.

For further interactions you could just read up on the MSDN articles and set the members of the NOTIFYICONDATA and message parameter of the Shell_NotifyIcon() function accordingly. You will have to receive and interpret windows messages sent from the tray icon to handle it further. This is easily done using BlueGUI if you have that, but there are other ways as well.

To run this code you will need to have Matrix1Utilities. An example icon is attached to this post.




"Why do programmers get Halloween and Christmas mixed up?"

Attachments

Login to view attachments
Mage
17
Years of Service
User Offline
Joined: 3rd Feb 2007
Location: Canada
Posted: 23rd Jun 2013 16:51
Quote: "That's Microsoft's inconsistent naming conventions for you!"

I think it's a name change they made in the XP or possibly later era.

Quote: "Well, here's a starting point.
Running this will display the icon in the system tray and you will see its tooltip by holding your cursor over it."
Holy smokes. That's a lot of code to do one little thing.

GIDustin
15
Years of Service
User Offline
Joined: 30th May 2008
Location:
Posted: 23rd Jun 2013 18:21
Well, I am glad to see this. I asked for a better System Tray DLL Two Years Ago and if the commands could be coded in DBPro instead of a DLL, that would be awesome!

Tagging this for updates.
Rudolpho
18
Years of Service
User Offline
Joined: 28th Dec 2005
Location: Sweden
Posted: 24th Jun 2013 03:46 Edited at: 24th Jun 2013 03:47
Quote: "Holy smokes. That's a lot of code to do one little thing."

Not really, most of it is just constant declarations and wrapper functions for dll calls, as well as the rather tedious way in which a C++ struct is emulated.
The actual code for displaying the icon is just these lines once that is done:


Doing other things once this basic functionality is set up is then pretty easy.
For example you could show a pop-up balloon for the icon simply by adding the NIF_INFO flag to the NID_SetFlags() call.
By calling Shell_NotifyIcon() with the same NOTIFYICONDATA structure (or a modified version of it) and different messages, such as NIM_MODIFY, you could then show or hide the balloon at will, while having the icon remain in the systray.


"Why do programmers get Halloween and Christmas mixed up?"
Burning Feet Man
16
Years of Service
User Offline
Joined: 4th Jan 2008
Location: Sydney, Australia
Posted: 24th Jun 2013 04:57
This is a huge effort, thank you so much! I'll tinker with this some more once I have the time, then post my tweaks.

Awesome stuff Rudolpho!

Help build an online DarkBASIC Professional help archive.
DarkBasic Help Wikia

Login to post a reply

Server time is: 2024-05-03 22:44:35
Your offset time is: 2024-05-03 22:44:35