Window not visible in taskbar !

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

Post Reply
Okapi
Junior Coder
Posts: 28
Joined: Wed Dec 29, 2010 1:22 am

Window not visible in taskbar !

Post by Okapi » Sun Apr 03, 2011 6:29 pm

Hi all,
I've launched a program hidden, but when using SetFocus to send some keys to it, it is visible again. So I've used a code I've found here to make it's window transparent, it works. But the window is still visible in taskbar.

How to make a window not visible in taskbar ?

I've searched about it and found it's possible by doing something like :
LibFunc>user32,SetWindowLongA,handle,-20,0x80
http://forum.pcsoft.fr/thread.awp?group ... tid=195368
http://source.winehq.org/WineAPI/SetWindowLongA.html

I'm not programmer, can someone help ? Thanks.
Last edited by Okapi on Sun Apr 03, 2011 10:04 pm, edited 1 time in total.

User avatar
jpuziano
Automation Wizard
Posts: 1085
Joined: Sat Oct 30, 2004 12:00 am

Post by jpuziano » Sun Apr 03, 2011 9:37 pm

Hi Okapi and all,

That's an interesting question... sorry I don't have an answer... though I did take a look at the first link you provided... but its a forum post in French. Here's that same page only translated into English:

http://babelfish.yahoo.com/translate_ur ... =Translate

Take care
jpuziano

Note: If anyone else on the planet would find the following useful...
[Open] PlayWav command that plays from embedded script data
...then please add your thoughts/support at the above post - :-)

User avatar
JRL
Automation Wizard
Posts: 3526
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Post by JRL » Mon Apr 04, 2011 2:14 pm

LibFunc>user32,SetWindowLongA,handle,-20,0x80
Two things: first you need a result variable (see HELP FOR LIBFUNC). Second the "0x80" is in hex and Libfunc> wants to see that converted to decimal so you need to use "128" instead.

So your libfunc line will look like:
LibFunc>user32,SetWindowLongA,SWLres,handle,-20,128

According to the Microsoft website this style is to make the application window a tool window.
Microsoft wrote:The window is intended to be used as a floating toolbar. A tool window has a title bar that is shorter than a normal title bar, and the window title is drawn using a smaller font. A tool window does not appear in the taskbar or in the dialog that appears when the user presses ALT+TAB. If a tool window has a system menu, its icon is not displayed on the title bar. However, you can display the system menu by right-clicking or by typing ALT+SPACE.
This might not appeal to you but there is only one other style option mentioned and it will probably appeal to you less.


The WS_EX_NOACTIVATE style:
Microsoft wrote:A top-level window created with this style does not become the foreground window when the user clicks it. The system does not bring this window to the foreground when the user minimizes or closes the foreground window.

To activate the window, use the SetActiveWindow or SetForegroundWindow function.

The window does not appear on the taskbar by default. To force the window to appear on the taskbar, use the WS_EX_APPWINDOW style.
To see what WS_EX_NOACTIVATE looks like, change the "128" at the end of the LibFunc line to "134217728" The first thing you'll notice is that you cannot set focus to the application window. But there won't be a taskbar entry.

Here's a sample using notepad.

Code: Select all

Let>RP_WINDOWMODE=0
Run>notepad.exe

WWO>notepad*
GetWindowHandle>Notepad*,handle

LibFunc>user32,SetWindowLongA,SWLres,handle,-20,128

MDL>Pick Ok to set focus to the toolbarred Notepad

SetFocus>Notepad*

User avatar
JRL
Automation Wizard
Posts: 3526
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Post by JRL » Mon Apr 04, 2011 3:25 pm

Hmmmm.
After looking at this a bit it would seem that the best option might be to use SetWindowLongA with the WS_EX_NOACTIVATE style, then use Microsoft's SetForegroundWindow function. See the following example. This gives me a normal notepad window with no taskbar entry.

Code: Select all

Let>RP_WINDOWMODE=0
Run>notepad.exe

WWO>notepad*
GetWindowHandle>Notepad*,handle

LibFunc>user32,SetWindowLongA,SWLres,handle,-20,134217728

MDL>Pick Ok to set focus to no taskbar Notepad
LibFunc>user32,SetForegroundWindow,SFWres,handle
SetFocus>Notepad*

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts