Jump to content

Gui'yi Taskbardan Gizlemek Nasıl Oluyor ?


x_files_x
 Share

Recommended Posts

Slm arkadaslar diyelimki elimde bir gui penceresi var birde buton olsun, o butona basınca guinin sistem traya degilde sadece altta bulunan isim ve ikon varya, sistem cubugundaki, iste orda hicbirseyi olmasın istiyorum, elimde bir ornegi var ama, cok karısık mantıgını anlamadımm ve icinde baska seylerde var, sadece o kodu bulsam yeter, ornek surda;

[CODE]#include <GuiConstantsEx.au3>
#include <Constants.au3>
#include <GuiToolbar.au3>

Opt("TrayAutoPause", 0)
Opt("TrayMenuMode", 1)

Global $hToolbar = _FindToolbarWindow()
Global $gui = GUICreate("Test GUI", 200, 100)
Global $cbox = GUICtrlCreateCheckbox("Hide my taskbar button", 20, 20)

GUISetState()

While 1
$msg = GUIGetMsg()
Switch $msg
Case $cbox
Switch BitAND(GUICtrlRead($cbox), $GUI_CHECKED)
Case $GUI_CHECKED
_HideToolbarButton($gui, $hToolbar)
Case Else
_HideToolbarButton($gui, $hToolbar, False)
EndSwitch
Case $GUI_EVENT_MINIMIZE
; hide taskbar button
_HideToolbarButton($gui, $hToolbar)
Case $GUI_EVENT_CLOSE
ExitLoop
EndSwitch
$msg = TrayGetMsg()
Switch $msg
Case $TRAY_EVENT_PRIMARYDOWN
GUISetState(@SW_RESTORE)
If BitAND(GUICtrlRead($cbox), $GUI_CHECKED) <> $GUI_CHECKED Then _HideToolbarButton($gui, $hToolbar, False)
EndSwitch
WEnd

Func _FindToolbarWindow()
; find explorer toolbar window
; XP+
Local $hDesktop = _WinAPI_GetDesktopWindow()
Local $hTray = _FindWindowEx($hDesktop, 0, "Shell_TrayWnd", "")
Local $hReBar = _FindWindowEx($hTray, 0, "ReBarWindow32", "")
Local $hTask = _FindWindowEx($hReBar, 0, "MSTaskSwWClass", "")
Return _FindWindowEx($hTask, 0, "ToolbarWindow32", "")
EndFunc

Func _FindWindowEx($hParent, $hChild, $sClass, $sWindow)
; must create structs and use ptrs to account for passing a true NULL as classname or window title
; simply using "wstr" and "" does NOT work
Local $s1, $s2
If $sClass == "" Then
$sClass = 0
Else
$s1 = DllStructCreate("wchar[256]")
DllStructSetData($s1, 1, $sClass)
$sClass = DllStructGetPtr($s1)
EndIf
If $sWindow == "" Then
$sWindow = 0
Else
$s2 = DllStructCreate("wchar[256]")
DllStructSetData($s2, 1, $sWindow)
$sWindow = DllStructGetPtr($s2)
EndIf
Local $ret = DllCall("user32.dll", "hwnd", "FindWindowExW", "hwnd", $hParent, "hwnd", $hChild, "ptr", $sClass, "ptr", $sWindow)
$s1 = 0
$s2 = 0
Return $ret[0]
EndFunc

Func _FindToolbarButton($hwnd, $hTB)
Local $return = -1
Local $s = DllStructCreate("ptr")
; open process owning toolbar control
Local $PID
_WinAPI_GetWindowThreadProcessId($hTB, $PID)
Local $hProcess = _WinAPI_OpenProcess(0x410, False, $PID)
If $hProcess Then
Local $count = _GUICtrlToolbar_ButtonCount($hTB)
For $i = 0 To $count - 1
Local $ID = _GUICtrlToolbar_IndexToCommand($hTB, $i)
; button param is ptr to owner's window handle, stored in target process's memory space :)
Local $dwData = _GUICtrlToolbar_GetButtonParam($hTB, $ID)
; read the window handle from the explorer process
Local $ret = DllCall("kernel32.dll", "int", "ReadProcessMemory", "ptr", $hProcess, "ptr", $dwData, "ptr", DllStructGetPtr($s), "uint", 4, "uint*", 0)
If $ret[5] Then
If $hwnd == DllStructGetData($s, 1) Then
$return = $ID
ExitLoop
EndIf
EndIf
Next
_WinAPI_CloseHandle($hProcess)
EndIf
Return $return
EndFunc

Func _HideToolbarButton($hwnd, $hTB, $hide = True)
Local $ID = _FindToolbarButton($hwnd, $hTB)
If $ID <> -1 Then
_GUICtrlToolbar_HideButton($hTB, $ID, $hide)
EndIf
EndFunc[/CODE]

Edited by x_files_x
Link to comment
Share on other sites

Tam olarak ne istediğini anlamadım ama...
[CODE]
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#region ### START Koda GUI section ### Form=
Global $Form1, $Button1
Func Form1($Style = "", $ExStyle ="")
If IsHWnd($Form1) Then GUIDelete($Form1)
Global $Form1 = GUICreate("Form1", 615, 438, 192, 124, $Style, $ExStyle)
Global $Button1 = GUICtrlCreateButton("Button1", 104, 136, 393, 161)
GUISetState(@SW_SHOW)
EndFunc ;==>_GuiSetStyle
#endregion ### END Koda GUI section ###
Global $LL
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
If Not $LL Then
Form1(0, BitOR($WS_EX_TOOLWINDOW, $WS_EX_WINDOWEDGE))
Opt("TrayIconHide", 1)
$LL = True
Else
Form1(BitOR($GUI_SS_DEFAULT_GUI, $WS_SIZEBOX, $WS_THICKFRAME))
Opt("TrayIconHide", 0)
$LL = False
EndIf
EndSwitch
WEnd
[/CODE]

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Similar Content

    • By Cyph3r
      1- Shift + Click ; Görev çubuğunda açık olan bir uygulamaya shift'e basarak tıkladığınızda uygulamanın yeni bir kopyasını açabilirsiniz. Tabi bu çoklu pencerede çalışan uygulamalar için geçerli. Chrome vs. gibi
      2- Shift + Ctrl + Click ; Görev çubuğunda açık olan yada görev çubuğuna tutturulmuş olan bir uygulamaya Shift + Ctrl basıp fare ile tıklanığınızda uygulamanın bir kopyasını yönetici olarak açabilirsiniz.
      3- Shift + Sağ Click ; Görev çubuğundaki açık olan bir uygulamaya Shift'e basıp fare ile sağ tıkladığınızda eski stil "kapat, simge durumuna küçült..." işlemlerinin olduğu pencereye ulaşabilirsiniz.
      4- Ctrl + Click ; Görev çubuğunda grup olarak açık bulunan bir uygulamaya Ctrl tuşuna basıp fare ile sol tıkladığınızda gruptaki pencereler arasında sırayla geçiş yapabilirsiniz. 
       
      Ek olarak birkaç masaüstü kısayolu.
      Win + Ctrl + D: Yeni bir sanal masaüstü oluşturur.
      Win + Ctrl + F4: Mevcut sanal masaüstünü kapatır
      Win + Ctrl + Right: Oluşturulan birden çok sanal masaüstü arasında sağa doğru geçiş yapar
      Win + Ctrl + Left: Oluşturulan birden çok sanal masaüstü arasında sola doğru geçiş yapar
      Win + Tab: Oluşturulan tüm masaüstleri ve bunlarda açık olan uygulamaları önizleyebileceğiniz bir arayüz açar.
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...