zjg2003 发表于 2009-10-13 20:08:57

如何去掉任务栏的图标

本帖最后由 zjg2003 于 2009-10-15 09:43 编辑

注意: 指的是任务栏的图标,而不是系统托盘图标,谢谢!
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("测试", 200, 120, 300, 0, $WS_POPUP, $WS_EX_LAYERED)
GUISetBkColor(0xABCDEF)
_API_SetLayeredWindowAttributes($Form1, 0xABCDEF) ;设置透明,故不想有任务栏图标
$Label1 = GUICtrlCreateLabel("VVVVVxxx", 24, 16)
$Label2 = GUICtrlCreateLabel("VVVVVxxx", 24, 16)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
Sleep(500)
WEnd
Func _API_SetLayeredWindowAttributes($hwnd, $i_transcolor, $Transparency = 255, $isColorRef = False)
Local Const $AC_SRC_ALPHA = 1
Local Const $ULW_ALPHA = 2
Local Const $LWA_ALPHA = 0x2
Local Const $LWA_COLORKEY = 0x1
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", $LWA_COLORKEY + $LWA_ALPHA)
Select
Case @error
   Return SetError(@error, 0, 0)
Case $Ret = 0
   Return SetError(4, 0, 0)
Case Else
   Return 1
EndSelect
EndFunc   ;==>_API_SetLayeredWindowAttributes

kodin 发表于 2009-10-13 20:16:18

建多一个GUICreate,然后赋予隐藏属性。

afan 发表于 2009-10-13 20:19:42

#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("测试", 200, 120, 300, 0, $WS_POPUP, $WS_EX_LAYERED, WinGetHandle(AutoItWinGetTitle()))
GUISetBkColor(0xABCDEF)
_API_SetLayeredWindowAttributes($Form1, 0xABCDEF) ;设置透明,故不想有任务栏图标
$Label1 = GUICtrlCreateLabel("VVVVVxxx", 24, 16)
$Label2 = GUICtrlCreateLabel("VVVVVxxx", 24, 16)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
Sleep(500)
WEnd
Func _API_SetLayeredWindowAttributes($hwnd, $i_transcolor, $Transparency = 255, $isColorRef = False)
Local Const $AC_SRC_ALPHA = 1
Local Const $ULW_ALPHA = 2
Local Const $LWA_ALPHA = 0x2
Local Const $LWA_COLORKEY = 0x1
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", $LWA_COLORKEY + $LWA_ALPHA)
Select
Case @error
   Return SetError(@error, 0, 0)
Case $Ret = 0
   Return SetError(4, 0, 0)
Case Else
   Return 1
EndSelect
EndFunc   ;==>_API_SetLayeredWindowAttributes

kodin 发表于 2009-10-14 01:16:35

本帖最后由 kodin 于 2009-10-14 01:55 编辑

刚看了afan大大发的源码,呵呵!学习了一下WinGetHandle用法。
顺手写个我的。


#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form = GUICreate("")
$Form1 = GUICreate("测试", 200, 120, 300, 0,$WS_POPUP+$WS_EX_LAYERED,-1,$Form)
GUISetBkColor(0xABCDEF)
_API_SetLayeredWindowAttributes($Form1, 0xABCDEF) ;设置透明,故不想有任务栏图标
$Label1 = GUICtrlCreateLabel("VVVVVxxx", 24, 16)
$Label2 = GUICtrlCreateLabel("VVVVVxxx", 24, 16)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
Sleep(500)
WEnd
Func _API_SetLayeredWindowAttributes($hwnd, $i_transcolor, $Transparency = 255, $isColorRef = False)
Local Const $AC_SRC_ALPHA = 1
Local Const $ULW_ALPHA = 2
Local Const $LWA_ALPHA = 0x2
Local Const $LWA_COLORKEY = 0x1
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", $LWA_COLORKEY + $LWA_ALPHA)
Select
Case @error
   Return SetError(@error, 0, 0)
Case $Ret = 0
   Return SetError(4, 0, 0)
Case Else
   Return 1
EndSelect

zjg2003 发表于 2009-10-14 23:38:35

本帖最后由 zjg2003 于 2009-10-14 23:51 编辑

先谢谢楼上二位兄台. 另 kodin 兄弟的代码最后少了一个EndFunc

想请教一下:
$Form1 = GUICreate("测试", 200, 120, 300, 0, $WS_POPUP, $WS_EX_LAYERED, WinGetHandle(AutoItWinGetTitle()))
这句是否可以这样理解:为$Form1指定一个隐藏的父窗体,故而没有任务栏图标?

78391493 发表于 2009-10-15 08:44:04

先谢谢楼上二位兄台. 另 kodin 兄弟的代码最后少了一个EndFunc

想请教一下:
$Form1 = GUICreate("测试", 200, 120, 300, 0, $WS_POPUP, $WS_EX_LAYERED, WinGetHandle(AutoItWinGetTitle()))
这句是否可以这样 ...
zjg2003 发表于 2009-10-14 23:38 http://www.autoitx.com/images/common/back.gif

Yes..........

zjg2003 发表于 2009-10-15 09:43:16

再次感谢各位坛友

menfan 发表于 2009-10-15 20:28:09

呵呵,学习一下。。

au3x 发表于 2011-12-4 13:06:14

顶一下.................
页: [1]
查看完整版本: 如何去掉任务栏的图标