Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


HTA: Icon in System Tray

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,66502
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> HTA: Icon in System Tray
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 HTA: Icon in System Tray - 11/16/2008 11:45:27 PM   
  SytnerIT

 

Posts: 12
Score: 0
Joined: 9/2/2008
Status: offline
Hello
 
I am currently creating an HTA.
 
I have configured the 'ShowIntaskBar' property to hide in the Windows Task Bar.
 
I would also like to create a Sytem Tray Icon for when it is running, is this possible?
 
Can I use the HTA Application Object to do this? If not can I use VBScript to do this?
 
Yours hopefully
Rob
 
SytnerIT
 
 
Post #: 1
 
 RE: HTA: Icon in System Tray - 11/17/2008 2:07:40 AM   
  ebgreen


Posts: 5251
Score: 31
Joined: 7/12/2005
Status: offline
The only methods that I am aware of for making a system tray icon involves calls to the Win32 APIs or the use of .Net methods. Neither of which are possible with an HTA or VBScript.

_____________________________

"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to SytnerIT)
 
 
Post #: 2
 
 RE: HTA: Icon in System Tray - 11/17/2008 2:38:00 AM   
  TNO


Posts: 1402
Score: 16
Joined: 12/18/2004
From: thenewobjective.com
Status: offline
You can sort of kinda mess with it through rundll commands but those are hit and miss. I've yet to figure it out with that method. If you are on a Windows Vista system you may have more options since they have a replacement for HTA's  (with background transparency too ).

@ebgreen: Is there a way to cleanly interop between powershell scripts and the WSH? Maybe as a cheap workaround for accessing the .NET framework?

_____________________________

To iterate is human, to recurse divine. -- L. Peter Deutsch

(in reply to ebgreen)
 
 
Post #: 3
 
 RE: HTA: Icon in System Tray - 11/17/2008 2:40:58 AM   
  ebgreen


Posts: 5251
Score: 31
Joined: 7/12/2005
Status: offline
Not that I am aware of. VBScript really only has one way to interop...COM. I don't believe that powershell exposes any COM interface.

_____________________________

"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to TNO)
 
 
Post #: 4
 
 RE: HTA: Icon in System Tray - 11/17/2008 3:01:11 AM   
  TNO


Posts: 1402
Score: 16
Joined: 12/18/2004
From: thenewobjective.com
Status: offline
I was thinking more in terms of the way we would use DOS to perform basic commands and then read back the result. For example: asking  DOS for the version of windows and reading the stdOut for the result.

_____________________________

To iterate is human, to recurse divine. -- L. Peter Deutsch

(in reply to ebgreen)
 
 
Post #: 5
 
 RE: HTA: Icon in System Tray - 11/17/2008 3:07:05 AM   
  ebgreen


Posts: 5251
Score: 31
Joined: 7/12/2005
Status: offline
Hmmm...that might be possible. But really, would it be worth it? If you wanted a really interactive sys tray icon, then you would have to keep the PS instance running in the background for as long as you wanted the sys tray icon to live. You would also need to have your HTA essentially process blocked because it is monitoring the STDOUT from the PS instance. You might be able to get around the HTA process blocking by having the PS process make changes directly back into the HTA when required, but the concurrentcy issues would be a nightmare. Truthfully I think it would be easier to just bust out C# and write a systray object with a COM interface.

_____________________________

"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to TNO)
 
 
Post #: 6
 
 RE: HTA: Icon in System Tray - 11/17/2008 3:26:17 AM   
  TNO


Posts: 1402
Score: 16
Joined: 12/18/2004
From: thenewobjective.com
Status: offline
hmm, you can add a key to disable the entire sys tray..


      

add key NoTrayItemsDisplay value = 1

So its in the ballpark but I don't have high hopes...

_____________________________

To iterate is human, to recurse divine. -- L. Peter Deutsch

(in reply to ebgreen)
 
 
Post #: 7
 
 RE: HTA: Icon in System Tray - 11/17/2008 3:29:08 AM   
  ebgreen


Posts: 5251
Score: 31
Joined: 7/12/2005
Status: offline
The problem is that sys tray icons are intended to be interactive (I know that not all of them are). So there would need to be a way to register event handlers with windows for you to really make one. I can't think of any way to register even handlers in VBScript except for WMI and I don't think WMI looks into the system tray.

_____________________________

"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to TNO)
 
 
Post #: 8
 
 RE: HTA: Icon in System Tray - 11/17/2008 3:41:56 AM   
  TNO


Posts: 1402
Score: 16
Joined: 12/18/2004
From: thenewobjective.com
Status: offline
Looking a bit more it seems to me alot of the activity passes through the user32.dll  (Shell.application)

It may have something to do with a NameSpace and using the shell to find the currently active window but I can't find any useful info (Wish I knew more C++ than I do to read the examples)

_____________________________

To iterate is human, to recurse divine. -- L. Peter Deutsch

(in reply to ebgreen)
 
 
Post #: 9
 
 RE: HTA: Icon in System Tray - 11/17/2008 3:43:23 AM   
  ebgreen


Posts: 5251
Score: 31
Joined: 7/12/2005
Status: offline
Ehh...what example are you looking at?

_____________________________

"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to TNO)
 
 
Post #: 10
 
 RE: HTA: Icon in System Tray - 11/17/2008 3:54:25 AM   
  TNO


Posts: 1402
Score: 16
Joined: 12/18/2004
From: thenewobjective.com
Status: offline
Here's one of the better ones  in VB I found:

http://support.microsoft.com/default.aspx?scid=kb%3ben-us%3b162613

There must be a way to make a call through rundll for this...

For example RUNDLL32 USER32.DLL,ExitWindowsEx

No COM API is exposed for that, but it can still be executed using rundll. Surely there is one for the system tray

_____________________________

To iterate is human, to recurse divine. -- L. Peter Deutsch

(in reply to ebgreen)
 
 
Post #: 11
 
 RE: HTA: Icon in System Tray - 11/17/2008 4:04:44 AM   
  ebgreen


Posts: 5251
Score: 31
Joined: 7/12/2005
Status: offline
Well, one problem that I can see right up front is that to add an icon you have to hand the function things that VBScript is just not equipped to handle. For instance you need to be able to register a Windows Mouse Move event handler for the form that represents the icon. You just can't do that in VBScript.

_____________________________

"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to TNO)
 
 
Post #: 12
 
 RE: HTA: Icon in System Tray - 11/17/2008 4:26:46 AM   
  TNO


Posts: 1402
Score: 16
Joined: 12/18/2004
From: thenewobjective.com
Status: offline
Best post I found yet. Too bad its more effort than its worth to implement:

http://km-dev.blogspot.com/2007/06/xpe-tip-48-get-rid-of-system-tray-icons.html

_____________________________

To iterate is human, to recurse divine. -- L. Peter Deutsch

(in reply to ebgreen)
 
 
Post #: 13
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> HTA: Icon in System Tray Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts