Jump to content

HowTo Hide $WS_POPUP GUI from ALT+TAB [Solved]


KaFu
 Share

Recommended Posts

HiHo Forum,

maybe anyone can answer this easily. I want to create a transparent GUI invisible in the taskbar and also invisible in the ALT+TAB dialogue.

Invisible in the taskbar I found via search, just create a child window and don't show the parent window. But this child window still shows up in the ALT-TAB.

Does anyone got a solution for this one?

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <WINAPI.au3>

$Form1 = GUICreate("hide", 1, 1, 1, 1)
$Form2 = GUICreate("Show", 100, 100, Default, Default, $WS_POPUP, $WS_EX_LAYERED, $Form1) ; will create a dialog box that when displayed is centered
GUISetBkColor(0xABCDEF)
_WinAPI_SetLayeredWindowAttributes($Form2, 0xABCDEF, 255)

GUICtrlCreateLabel("Test", 10, 10)

GUISetState(@SW_SHOW) ; will display an empty dialog box

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


;===============================================================================
;
; Function Name: _WinAPI_SetLayeredWindowAttributes
; Description:: Sets Layered Window Attributes:) See MSDN for more informaion
; Parameter(s):
; $hwnd - Handle of GUI to work on
; $i_transcolor - Transparent color
; $Transparency - Set Transparancy of GUI
; $isColorRef - If True, $i_transcolor is a COLORREF( 0x00bbggrr ), else an RGB-Color
; Requirement(s): Layered Windows
; Return Value(s): Success: 1
; Error: 0
; @error: 1 to 3 - Error from DllCall
; @error: 4 - Function did not succeed - use
; _WinAPI_GetLastErrorMessage or _WinAPI_GetLastError to get more information
; Author(s): Prog@ndy
;
; Link : @@MsdnLink@@ SetLayeredWindowAttributes
; Example : Yes
;===============================================================================
;
Func _WinAPI_SetLayeredWindowAttributes($hwnd, $i_transcolor, $Transparency = 255, $dwFlages = 0x03, $isColorRef = False)
    ; #############################################
    ; You are NOT ALLOWED to remove the following lines
    ; Function Name: _WinAPI_SetLayeredWindowAttributes
    ; Author(s): Prog@ndy
    ; #############################################
    If $dwFlages = Default Or $dwFlages = "" Or $dwFlages < 0 Then $dwFlages = 0x03

    If Not $isColorRef Then
        $i_transcolor = Hex(String($i_transcolor), 6)
        $i_transcolor = Execute('0x00' & StringMid($i_transcolor, 5, 2) & StringMid($i_transcolor, 3, 2) & StringMid($i_transcolor, 1, 2))
    EndIf
    Local $Ret = DllCall("user32.dll", "int", "SetLayeredWindowAttributes", "hwnd", $hwnd, "long", $i_transcolor, "byte", $Transparency, "long", $dwFlages)
    Select
        Case @error
            Return SetError(@error, 0, 0)
        Case $Ret[0] = 0
            Return SetError(4, _WinAPI_GetLastError(), 0)
        Case Else
            Return 1
    EndSelect
EndFunc   ;==>_WinAPI_SetLayeredWindowAttributes

Best Regards

Edited by KaFu
Link to comment
Share on other sites

with $WS_EX_TOOLWINDOW -> no hidden window needed to hide taskbarbutton :)

$Form2 = GUICreate("Show", 100, 100, Default, Default, $WS_POPUP, BitOR($WS_EX_TOOLWINDOW,$WS_EX_LAYERED) ); will create a dialog box that when displayed is centered
GUISetBkColor(0xABCDEF)
_WinAPI_SetLayeredWindowAttributes($Form2, 0xABCDEF, 255)

*GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes

Link to comment
Share on other sites

Strange, thought I tested that :) and it didn't work. Must have done something different wrong then. Thanks, works as intended. Doesn't even need to be a child this way.

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <WINAPI.au3>

$Form1 = GUICreate("HiddenApp", 100, 100, Default, Default, $WS_POPUP, BitOR($WS_EX_TOOLWINDOW,$WS_EX_LAYERED) ); will create a dialog box that when displayed is centered
GUISetBkColor(0xABCDEF)
_WinAPI_SetLayeredWindowAttributes($Form1, 0xABCDEF, 255)

GUICtrlCreateLabel("Test", 10, 10)

GUISetState(@SW_SHOW) ; will display an empty dialog box

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


;===============================================================================
;
; Function Name: _WinAPI_SetLayeredWindowAttributes
; Description:: Sets Layered Window Attributes:) See MSDN for more informaion
; Parameter(s):
; $hwnd - Handle of GUI to work on
; $i_transcolor - Transparent color
; $Transparency - Set Transparancy of GUI
; $isColorRef - If True, $i_transcolor is a COLORREF( 0x00bbggrr ), else an RGB-Color
; Requirement(s): Layered Windows
; Return Value(s): Success: 1
; Error: 0
; @error: 1 to 3 - Error from DllCall
; @error: 4 - Function did not succeed - use
; _WinAPI_GetLastErrorMessage or _WinAPI_GetLastError to get more information
; Author(s): Prog@ndy
;
; Link : @@MsdnLink@@ SetLayeredWindowAttributes
; Example : Yes
;===============================================================================
;
Func _WinAPI_SetLayeredWindowAttributes($hwnd, $i_transcolor, $Transparency = 255, $dwFlages = 0x03, $isColorRef = False)
    ; #############################################
    ; You are NOT ALLOWED to remove the following lines
    ; Function Name: _WinAPI_SetLayeredWindowAttributes
    ; Author(s): Prog@ndy
    ; #############################################
    If $dwFlages = Default Or $dwFlages = "" Or $dwFlages < 0 Then $dwFlages = 0x03

    If Not $isColorRef Then
        $i_transcolor = Hex(String($i_transcolor), 6)
        $i_transcolor = Execute('0x00' & StringMid($i_transcolor, 5, 2) & StringMid($i_transcolor, 3, 2) & StringMid($i_transcolor, 1, 2))
    EndIf
    Local $Ret = DllCall("user32.dll", "int", "SetLayeredWindowAttributes", "hwnd", $hwnd, "long", $i_transcolor, "byte", $Transparency, "long", $dwFlages)
    Select
        Case @error
            Return SetError(@error, 0, 0)
        Case $Ret[0] = 0
            Return SetError(4, _WinAPI_GetLastError(), 0)
        Case Else
            Return 1
    EndSelect
EndFunc   ;==>_WinAPI_SetLayeredWindowAttributesoÝ÷ اµéݶ¬zØb²Ú­æ­y«rÝéiz¶©¦«¨µº.Ú®¢Ûh¶©®)¯&©¥h¥Ú,£­©ÚvX{azf¢ªijwZºÚ"µÍ[È^XYX
B   ÌÍÜÜ×ÝØ]ÚHÚ[Ù]ÜÊÚ[Ù][J    ][ÝÒY[    ][ÝË  ][ÝÉ][ÝÊJBYÚ[]J ÌÍÙÝZWÛXZ[HHYH[    ÌÍÙY×ØÚ[ÙWÜÙXÛÛØÛÛÙHH[ÕÚ[TWÔÙ]Ú[ÝÔÜÊÚ[Ù][J    ][ÝÒY[    ][ÝË  ][ÝÉ][ÝÊK   ÌÍÒÓÕÔSÔÕ   ÌÍÜÜ×ÝØ]ÚÌK    ÌÍÜÜ×ÝØ]ÚÌWK   ÌÍÜÜ×ÝØ]ÚÌK    ÌÍÜÜ×ÝØ]ÚÌ×K  ÌÍÔÕÔÓÐPÕUUJBÕÚ[TWÔÙ]Ú[ÝÔÜÊÚ[Ù][J    ][ÝÒY[    ][ÝË  ][ÝÉ][ÝÊK   ÌÍÒÓÓÕÔSÔÕ ÌÍÜÜ×ÝØ]ÚÌK    ÌÍÜÜ×ÝØ]ÚÌWK   ÌÍÜÜ×ÝØ]ÚÌK    ÌÍÜÜ×ÝØ]ÚÌ×K  ÌÍÔÕÔÓÐPÕUUJB   ÌÍÙY×ØÚ[ÙWÜÙXÛÛØÛÛÙHHB[ÙRYÚ[]J  ÌÍÙÝZWÛXZ[HH[ÙH[  ÌÍÙY×ØÚ[ÙWÜÙXÛÛØÛÛÙHHH[  ÌÍÙY×ØÚ[ÙWÜÙXÛÛØÛÛÙHH[Y[[ÈÏOIÝÛ^XYX

This part already worked as intended :). If the main app is activated the second app is set ontop. If main app receives @sw_hide or @sw_show so will the helper-app.

Best Regards

Gruss

Edited by KaFu
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...