Sign in to follow this  
Followers 0
momitty

How to hide a taskbar icon for a window/program?

17 posts in this topic

#1 ·  Posted (edited)

Here's an example of what I want to do: Any time a Word document opens I want to have an autoit script hide the button on the taskbar, but keep the window visible. Is this possible? I can set the window state to @SW_HIDE, but then I can't access the window.

Does anybody have any suggestions?

Is this possibly controlled by a DLL call?

Edited by momitty

Share this post


Link to post
Share on other sites



When I use the window info tool it doesn't show the buttons or any info on them. It just says the class name is Shell_TrayWnd. But it about has to be able to be done through a DLL at least. I see other people messing with the tray icons through a DLL. The DLL stuff looks pretty powerful... if you can change the resolution of the screen even through a DLL then this should be possible.

Share this post


Link to post
Share on other sites

Ok looks 2 me u are trying to make a bot or something around that.

Hide the program running on your task so blizzard cant say he is running this and that.

Well i have looked in 2 this also but I know auto it has a Random title name some were in the Help but just look around there.

Sorry not much help.


Share this post


Link to post
Share on other sites

I'm not making a bot... here's what I'm actually trying to accomplish.... There is a graphics program called GIMP. Most people on here are probably familiar with it, but if not, it's an open source Photoshop type program. I like its features, but I hate how it opens windows. For every image, toolbar and dialog it opens a new window.... so each one takes up a space on the taskbar. I'm trying to make a script that when a new window spawned by the main window opens it up it hides the taskbar button for it. This script also makes it so when you activate gimp all the windows come to the top.

There is a plug in for GIMP that somebody made to kind of do this but it's real flaky. I'm basically making GIMP act like a MDI interface where everything is contained in one taskbar button.

I've got the part for keeping all the windows working as one program down... but now it just is a matter of getting rid of all the useless taskbar icons (this is VERY annoying once XP starts grouping the taskbar icons... or if you have that turned off once all the buttons start scrolling).

Tomorrow when I get back in front of my computer with GIMP I'll upload a screenshot so anybody who has never used it can see how ridiculous it is even with like 2 or 3 images open.

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Every GIMP window creates a taskbar icon. It gets pretty messy after just a few images and toolbars are open

post-5378-1171042938_thumb.jpg

I'd like to have the main toolbar keep it's button on the taskbar, but nothing else (but the windows need to stay visible)

Edited by momitty

Share this post


Link to post
Share on other sites

Every GIMP window creates a taskbar icon. It gets pretty messy after just a few images and toolbars are open

post-5378-1171042938_thumb.jpg

I'd like to have the main toolbar keep it's button on the taskbar, but nothing else (but the windows need to stay visible)

You know, I made a function so long ago to do this, and to save my life, I can't remember what the name of the function was to even search for it... If you're really desperate, and I mean really desperate, you could dig through the first 6k or 7k of my posts.

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

You know, I made a function so long ago to do this, and to save my life, I can't remember what the name of the function was to even search for it... If you're really desperate, and I mean really desperate, you could dig through the first 6k or 7k of my posts.

let me help you :whistle:

Smoke_N: http://www.autoitscript.com/forum/index.ph...st&p=150496

cool0403: http://www.autoitscript.com/forum/index.ph...st&p=261857

Cheers

Kurt

Edited by /dev/null

__________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf *

Share this post


Link to post
Share on other sites

Ha, I guess I didn't do what I thought I did :whistle:

Anyway, I thought this might have worked using SWP_HIDEWINDOW and SWP_SHOWWINDOW, but I couldn't get it to work right, and don't have time to mess with it:

#include <misc.au3>
$hWnd = WinGetHandle('')
_SendMessage($hWnd, 0x080, 1, 0)
Sleep(3000)
_SendMessage($hWnd, 0x040, 0, 0)

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

There is a plug in for GIMP that somebody made to kind of do this but it's real flaky. I'm basically making GIMP act like a MDI interface where everything is contained in one taskbar button.

what's the name of that plug in?


__________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf *

Share this post


Link to post
Share on other sites

#11 ·  Posted (edited)

I tried those scripts but they hide the window too, not just the taskbar icon.

The plug in name if you search for it on Google is called "Gimp Deweirdifyer", but when you extract it out, it's called "backgroundWindow".

The problem with the plug in, is that for some reason windows occasionally get placed off screen (I've seen them go as far as -32000 pixels if you use the window tool). And once they are in that plug in, AutoIt can't interact with them any more, so I can't just make a script to go find all the windows.

I like Gimp just fine, except it can't manage its windows very well. It is GTK based, and from what I've found so far GTK doesn't have a way to do an MDI interface.

Edited by momitty

Share this post


Link to post
Share on other sites

O.K., here is an excerpt from a wikipedia entry: http://en.wikipedia.org/wiki/Taskbar

The Windows Shell places a taskbar button on the taskbar whenever an application creates an unowned window: that is, a window that doesn't have a parent and that is created according to normal Windows UI guidelines. Typically all SDI applications have a single taskbar button for each open window, although modal windows may also appear there. Windows XP introduced taskbar grouping, which can group the taskbar buttons of several windows from the same application into a single button. This button pops up a menu listing all the grouped windows when clicked. This keeps the taskbar from being overcrowded when many windows are open at once.

So, whenever a window does not have a parent, the shell will create an icon in the task bar. So, a possible solution could be to set a new parent for the windows (API: SetParent). Basically that works (I tested it, and the icon of notepad.exe disappeared), BUT, the windows are then "captured" within the client area of the new parent, and I don't know if the main GIMP window will then be able to communicate with those windows.... I tried to find a way to disable the whole feature with the Windows Shell, but I could not find a way to do it (did not search that much!!). O.K. now, you have at least something from where you can start ....

Very simple "proof" of concept:

#include <GUIConstants.au3>

$myhandle = GUICreate("My GUI") 
GUISetState (@SW_SHOW)

Run("notepad.exe")
WinWaitActive("Untitled")
$notepad = WinGetHandle("Untitled")

DllCall("user32.dll","hwnd","SetParent","hwnd",$notepad,"hwnd",$myhandle)

; Run the GUI until the dialog is closed
While 1
    $msg = GUIGetMsg()
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
Wend

Cheers

Kurt


__________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf *

Share this post


Link to post
Share on other sites

I tried those scripts but they hide the window too, not just the taskbar icon.

The plug in name if you search for it on Google is called "Gimp Deweirdifyer", but when you extract it out, it's called "backgroundWindow".

Funny, sounds like "Gimp Deweirdifyer" does exactly what I have described in my last post :whistle:, so that plug-in is probably your best chance!


__________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf *

Share this post


Link to post
Share on other sites

Your solution is great!!! This is the big difference between the gimp plugin and this script... I can still control window positions. And windows so far always seem to stay where I want them.

I took your code and instead of trapping a notepad window I grab the first thing I find that is a GDK window and throw it in there. The only big limitations right now are, if you close the GUI it hides or closes (I'm not sure) all the gimp windows down with it, but Gimp is still running in the task manager chewing up RAM. Do you know how to make a Window not the parent? I'll just do the opposite on exit. Also of course if you are running anything else build in GDK it will attach to this. But on a Windows machine I don't know too much that uses it.

#include <GUIConstants.au3>

$myhandle = GUICreate("Gimp Window Holder", @DesktopWidth-50, @DesktopHeight-100, 0, 0)
GUISetState (@SW_SHOW)
AutoItSetOption("WinTitleMatchMode", 4)

; Run the GUI until the dialog is closed
While 1
    $msg = GUIGetMsg()
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
    
    if WinActive("classname=gdkWindowToplevel") then
        
        $gimpwindow = WinGetHandle("classname=gdkWindowToplevel")
        $pos = WinGetPos($gimpwindow);
        
        DllCall("user32.dll","hwnd","SetParent","hwnd",$gimpwindow,"hwnd",$myhandle)
        
        WinMove($gimpwindow, "", $pos[0], $pos[1])
    
    EndIf
Wend

Also, the WinMove just moves the gimp window to the same spot it was on the screen. I'm sure there are a lot more improvements I can do (like make the icon of the GUI the gimp icon so it's more intuitive) but this is a great start.

THANKS!!!!!!!!!!!!!!!!!!!!

Share this post


Link to post
Share on other sites

I took your code and instead of trapping a notepad window I grab the first thing I find that is a GDK window and throw it in there. The only big limitations right now are, if you close the GUI it hides or closes (I'm not sure) all the gimp windows down with it, but Gimp is still running in the task manager chewing up RAM. Do you know how to make a Window not the parent? I'll just do the opposite on exit. Also of course if you are running anything else build in GDK it will attach to this. But on a Windows machine I don't know too much that uses it.

Set the parent Window handle to NULL (0).

http://msdn.microsoft.com/library/default....s/getparent.asp

DllCall("user32.dll","hwnd","SetParent","hwnd",$gimpwindow,"hwnd",0)

Also, the WinMove just moves the gimp window to the same spot it was on the screen. I'm sure there are a lot more improvements I can do (like make the icon of the GUI the gimp icon so it's more intuitive) but this is a great start.

THANKS!!!!!!!!!!!!!!!!!!!!

Nice. I'm sure you can post the final result here´... :whistle:

__________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf *

Share this post


Link to post
Share on other sites

When I get back in to work on Monday I'll finish it up and post it here.

Share this post


Link to post
Share on other sites

When I get back in to work on Monday I'll finish it up and post it here.

ಠ_ಠ

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0