nend Posted October 22, 2011 Share Posted October 22, 2011 Hoi Guys, Is it possible to make a window a child of the task bar? I want to display a small window on the task bar witch is always visible with the task bar (win7) I can display a window on the task bar but he will send to the back when I click on the task bar. I want to look like the window is a part of the task bar so I think it has to be a child window of the task bar. Thanks Link to comment Share on other sites More sharing options...
guinness Posted October 22, 2011 Share Posted October 22, 2011 In GUICreate() for the handle use WinGetHandle(AutoItWinGetTitle()), this will make the GUI the child of the hidden AutoIt window. Look in my signature to know what AutoItWinGetTitle() is (Hint: Hidden AutoIt window.) UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
nend Posted October 22, 2011 Author Share Posted October 22, 2011 Hoi Guinness, I've looked at your “AutoItWinGetTitle” but I don't see how this can help me. I've already tried it with Wingethandle but I wasn’t possible to get it to work. Can you give me a small example? Link to comment Share on other sites More sharing options...
guinness Posted October 22, 2011 Share Posted October 22, 2011 #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> GUICreate("AutoItWinGetTitle() with Window ontop.", 200, 200, -1, -1, -1, $WS_EX_TOPMOST, WinGetHandle(AutoItWinGetTitle())) GUISetState(@SW_SHOW) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE GUIDelete() ExitLoop EndSwitch WEnd ;~ Or get the handle of the taskbar. You now have 2 options. GUICreate("Handle of Shell_TrayWnd", 200, 200, -1, -1, -1, -1, WinGetHandle("[CLASS:Shell_TrayWnd]")) GUISetState(@SW_SHOW) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
nend Posted October 22, 2011 Author Share Posted October 22, 2011 (edited) #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> GUICreate("", 169, 68, 20, 20, -1, $WS_EX_MDICHILD, WinGetHandle("[CLASS:Shell_TrayWnd]")) GUICtrlCreateLabel("test", 0, 0, 100, 20) GUISetState(@SW_SHOW) Do $msg = GUIGetMsg() Until $msg = $GUI_EVENT_CLOSE Hoi Guinness, Thanks for the example. But...... I’m looking for a mdi child of the task bar not only a child. Like the code ontop (only this won't work) I want to display a window as a mdi child in the task bar just like it's a part of the task bar Edited October 22, 2011 by nend Link to comment Share on other sites More sharing options...
guinness Posted October 22, 2011 Share Posted October 22, 2011 $WS_EX_MDICHILD is not really useful in this instance. (Read the description again of $WS_EX_MDICHILD) I would go with my second example. UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
nend Posted October 22, 2011 Author Share Posted October 22, 2011 (edited) Hoi Guinness, This is a peace of the code I use this will display a glowing text on the taskbar left next to the systray. This code works well but when I click on the task bar the text goose behind the taskbar. I can set always ontop bit but I want it to be always visible when the taskbar is visible. So when I open something in fullscreen (a movie of something) then this wil popup true the fullscreen when I use the ontop bit. Thats why I'm trying to do something with a child window. Have you got a idea? expandcollapse popup#include <SendMessage.au3> #include <WindowsConstants.au3> #Include <GDIPlus.au3> #Include <WinAPI.au3> Global Const $DTT_GLOWSIZE = 0x00000800 Global Const $DTT_COMPOSITED = 0x00002000 Global $glowsize = 8 Local $pos If Not IsDeclared("WM_DWMCOMPOSITIONCHANGED") Then Global Const $WM_DWMCOMPOSITIONCHANGED = 0x031E If Not IsDeclared("tagDTTOPTS") Then Global Const $tagDTTOPTS = _ "uint Size;uint Flags;uint clrText;uint clrBorder;uint clrShadow;int TextShadowType;" & $tagPOINT & _ ";int BorderSize;int FontPropId;int ColorPropId;int StateId;int ApplyOverlay;int GlowSize;ptr DrawTextCallback;int lParam;" $pos = ControlGetPos("[CLASS:Shell_TrayWnd]", "", "[CLASS:ReBarWindow32]") $hGUI = GUICreate("ROtext", 0, 0, 0, 0, $WS_POPUP, $WS_EX_TOOLWINDOW) Global $hTheme = _WinAPI_OpenThemeData($hGUI, "globals") GUIRegisterMsg($WM_DWMCOMPOSITIONCHANGED, "_WM_DWMCOMPOSITIONCHANGED") GUISetState(@SW_SHOWNA, $hGUI) _SendMessage($hGUI, $WM_DWMCOMPOSITIONCHANGED) _DrawText("this is a test") Sleep(10000) Func _DrawText($textlabel) Local $hDC, $tClientRect, $sText, $textwidth, $th $iW = @DesktopWidth $iH = @DesktopHeight If WinActive("[CLASS:Progman; Title:Program Manager]") Then $visible = 1 Else $aPos = WinGetPos("[ACTIVE]") If IsArray($aPos) Then If UBound($aPos) < 5 Then If $aPos[2] >= $iW And $aPos[3] >= $iH Then $visible = False Else $visible = True EndIf EndIf Else $visible = True EndIf EndIf If $visible Then If @OSVersion = "WIN_VISTA" Then $pos = ControlGetPos("[CLASS:Shell_TrayWnd]", "", "[CLASS:ReBarWindow32]") Else $pos = ControlGetPos("[CLASS:Shell_TrayWnd]", "", "[CLASS:MSTaskListWClass]") EndIf $th = WinGetClientSize("[CLASS:Shell_TrayWnd]") $textwidth = Measure($textlabel) + 10 WinMove($hGUI , "", $pos[2] - $textwidth + 55, @DesktopHeight - ($th[1]/2) -15 , $textwidth, 30) WinSetOnTop($hGUI, "", 1) $hDC = _WinAPI_GetDC($hGUI) $tClientRect = _WinAPI_GetClientRect($hGUI) _DrawGlowingText($hDC, $textlabel, $tClientRect, $glowsize) _WinAPI_ReleaseDC($hGUI, $hDC) Else $hDC = _WinAPI_GetDC($hGUI) $tClientRect = _WinAPI_GetClientRect($hGUI) _DrawGlowingText($hDC, "", $tClientRect, $glowsize) _WinAPI_ReleaseDC($hGUI, $hDC) EndIf EndFunc Func _WM_DWMCOMPOSITIONCHANGED($hWnd, $iMsg, $iwParam, $ilParam) Local $tMargs = DllStructCreate($tagMARGINS) If _WinAPI_DwmIsCompositionEnabled() Then For $i = 1 To 4 DllStructSetData($tMargs, $i, -1) Next _WinAPI_DwmExtendFrameIntoClientArea($hWnd, $tMargs) EndIf Return 0 EndFunc Func _DrawGlowingText($hDC, $sText, $tRc, $iGlowSize) Local $hCDC Local $tRcText Local $tBI, $tDTO Local $hDIBBmp, $hOldBmp Local $tST $hCDC = _WinAPI_CreateCompatibleDC($hDC) $tBI = DllStructCreate($tagBITMAPINFO) DllStructSetData($tBI, "Size", DllStructGetSize($tBI)-4) DllStructSetData($tBI, "Width", DllStructGetData($tRc, "Right")-DllStructGetData($tRc, "Left")) DllStructSetData($tBI, "Height", -(DllStructGetData($tRc, "Bottom")-DllStructGetData($tRc, "Top"))) DllStructSetData($tBI, "Planes", 1) DllStructSetData($tBI, "BitCount", 32) DllStructSetData($tBI, "Compression", 0) $hDIBBmp = _WinAPI_CreateDIBSection($hDC, $tBI) $hOldBmp = _WinAPI_SelectObject($hCDC, $hDIBBmp) $tDTO = DllStructCreate($tagDTTOPTS) DllStructSetData($tDTO, "Size", DllStructGetSize($tDTO)) DllStructSetData($tDTO, "Flags", BitOR($DTT_GLOWSIZE, $DTT_COMPOSITED)) DllStructSetData($tDTO, "GlowSize", $iGlowSize) _WinAPI_DrawThemeTextEx($hTheme, $hCDC, 0, 0, $sText, BitOR($DT_SINGLELINE, 1, $DT_VCENTER, $DT_NOPREFIX), $tRc, $tDTO) _WinAPI_BitBlt($hDC, DllStructGetData($tRc, "Left"), DllStructGetData($tRc, "Top"),DllStructGetData($tRc, "Right")-DllStructGetData($tRc, "Left"),DllStructGetData($tRc, "Bottom")-DllStructGetData($tRc, "Top"), $hCDC, 0, 0, 0xCC0020) ; SRCCOPY _WinAPI_SelectObject($hCDC, $hOldBmp) _WinAPI_DeleteObject($hDIBBmp) _WinAPI_DeleteDC($hCDC) EndFunc Func _WinAPI_DwmExtendFrameIntoClientArea($hWnd, ByRef $tMargins) Local $aResult = DllCall("dwmapi.dll", "int", "DwmExtendFrameIntoClientArea", "hwnd", $hWnd, "ptr", DllStructGetPtr($tMargins)) If @error Then Return SetError(@error, @extended, -1) Return $aResult[0] EndFunc Func _WinAPI_DwmIsCompositionEnabled() Local $aResult = DllCall("dwmapi.dll", "int", "DwmIsCompositionEnabled", "int*", 0) If @error Then Return SetError(@error, @extended, -1) Return SetError($aResult[0], 0, $aResult[1]) EndFunc Func _WinAPI_CreateDIBSection($hDC, Const ByRef $tBmpInfo, $iUsage = 0, $pBits = 0, $hSecond = 0, $iOffset = 0) Local $aResult = DllCall("gdi32.dll", "hwnd", "CreateDIBSection", "hwnd", $hDC, "ptr", DllStructGetPtr($tBmpInfo), "uint", $iUsage, "ptr", $pBits, "hwnd", $hSecond, "uint", $iOffset) Return SetError(0, 0, $aResult[0]) EndFunc Func _WinAPI_DrawThemeTextEx($hTheme, $hDC, $iPartId, $iStateId, $sText, $iFlags, ByRef $tRect, Const ByRef $tDTTOPTS) Local $aResult = DllCall("uxtheme.dll", "int", "DrawThemeTextEx", "ptr", $hTheme, "hwnd", $hDC, "int", $iPartId, "int", $iStateId, "wstr", $sText, "int", -1, "uint", $iFlags, "ptr", DllStructGetPtr($tRect), "ptr", DllStructGetPtr($tDTTOPTS)) Return SetError(0, 0, $aResult[0] = 0) EndFunc Func _WinAPI_OpenThemeData($hWnd, $sClassList, $hDll = "uxtheme.dll") Local $aResult = DllCall($hDll, "hwnd", "OpenThemeData", "hwnd", $hWnd, "wstr", $sClassList) If @error Then Return SetError(@error, @extended, 0) Return SetError(0, 0, $aResult[0]) EndFunc Func Measure($text) _GDIPlus_Startup () local $w Local $hWnd Local $hBuffer = _GDIPlus_GraphicsCreateFromHWND ($hWnd) Local $hFormat = _GDIPlus_StringFormatCreate () Local $hFamily = _GDIPlus_FontFamilyCreate ("Times New Roman") Local $hFont = _GDIPlus_FontCreate ($hFamily, 11.5, 2) Local $tLayout = _GDIPlus_RectFCreate (0, 0, 0, 0) Local $aInfo = _GDIPlus_GraphicsMeasureString ($hBuffer, $text, $hFont, $tLayout, $hFormat) $w = DllStructGetData($aInfo[0],3) _GDIPlus_FontDispose ($hFont) _GDIPlus_FontFamilyDispose ($hFamily) _GDIPlus_StringFormatDispose ($hFormat) _GDIPlus_Shutdown () Return $w EndFunc Edited October 22, 2011 by nend Link to comment Share on other sites More sharing options...
auemitpas Posted December 15, 2012 Share Posted December 15, 2012 Great script! You could distribute final code if you solved the problem? Thanks! Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now