Login | |
|
 |
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
|
|
| |
|
|
|
 |
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
|
|
| |
|
|
|
 |
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
|
|
| |
|
|
|
 |
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
|
|
| |
|
|
|
 |
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
|
|
| |
|
|
|
 |
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
|
|
| |
|
|
|
 |
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
|
|
| |
|
|
|
 |
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
|
|
| |
|
|
|
 |
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
|
|
| |
|
|
|
|
|