monte Posted March 3, 2007 Posted March 3, 2007 Hello, I'm trying to create a black box-like (bblean, fluxbox) taskbar for windows. I can get all the applications that have windows open, but how do I create a multi-paned control (label, button, etc.) in which to place the referenced open windows? I've been searching and searching but havn't found any answers. Please note that my posting here is a last resort, I don't post first and then search later in hopes of an easy answer. when running my code, press esc to exit. Basically you'll see a taskbar that replaces the windows taskbar. There's a go button which replaces the start button and a clock on the right end. What I want to do is have a taskbar that only displays the first five opened windows and then an arrow that can be clicked that'll show the other opened windows (just like how the quick launch works). I also want this for the systemtray, but only displaying one or two icons, then having an arrow that can be clicked that'll show the other icons. Thanks for any help you can provide. Please look at the ";populate title bar here?" line of code, this is where I'm assuming I'd create and populate the "taskbar". expandcollapse popup#include <GUIConstants.au3> #include <Date.au3> adlibenable("clockTimer", 100) Opt("TrayAutoPause", 0) Opt("TrayMenuMode",1) Opt("RunErrorsFatal", 0) Opt("SendKeyDelay", 1) Opt("WinDetectHiddenText", 1) Opt("WinTitleMatchMode", 4) Opt("WinWaitDelay", 0) ;;;;;;;;;;;;;;;;;;;;;; ;one instance, please ;;;;;;;;;;;;;;;;;;;;;; $g_szVersion = "xpSkin" If WinExists($g_szVersion) Then Exit AutoItWinSetTitle($g_szVersion) ;;;;;;;;;;;;; ;hot keys ;;;;;;;;;;;;; ;;;;;;;;;;;;; ;! = alt ;+ = shift ;^ = control ;# = windows ;;;;;;;;;;;;; HotKeySet("^v", "paste") HotKeySet("{ESC}", "quit") ;;;;;;;;;;;;;;;;;;; ;create tray items ;;;;;;;;;;;;;;;;;;; $apply = TrayCreateItem("Apply") $revert = TrayCreateItem("Revert") $exititem = TrayCreateItem("Exit") TraySetIcon("C:\Program Files\bash.ico") TraySetToolTip("Skin") TraySetState() ;;;;;;;;;;;; ;create gui ;;;;;;;;;;;; $xpSkin = guicreate ("xpSkin", @desktopwidth / 4 * 3, @desktopheight/38.4, -1, @desktopheight - 25, BitOr($WS_POPUP,$WS_DLGFRAME,$WS_EX_TOOLWINDOW)) GUISetBkColor(0x000000) $goButton = GUICtrlCreateLabel ("Go", 3, 3, 25) GUICtrlSetBkColor($goButton, 0x000000) GUICtrlSetColor($goButton, 0x00ff00) $OptionsDummy = GUICtrlCreateDummy() GUICtrlSetBkColor($OptionsDummy, 0x000000) GUICtrlSetColor($OptionsDummy, 0x00ff00) $OptionsContext = GUICtrlCreateContextMenu($OptionsDummy) GUICtrlSetBkColor($OptionsContext, 0x000000) GUICtrlSetColor($OptionsContext, 0x00ff00) ;quick links $bashDialog = GUICtrlCreateMenuItem("Bash", $OptionsContext, 0) $ieDialog = GUICtrlCreateMenuItem("Ie", $OptionsContext, 1) $notepadDialog = GUICtrlCreateMenuItem("Notepad", $OptionsContext, 2) $rdpDialog = GUICtrlCreateMenuItem("Rdp", $OptionsContext, 3) GUICtrlCreateMenuItem("", $OptionsContext, 4) ;programs menu $programsMenu = GUICtrlCreateMenu("Programs", $OptionsContext, 5) $accessoriesMenu = GUICtrlCreateMenu("Accessories", $ProgramsMenu, 0) $calculatorDialog = GUICtrlCreateMenuItem("Calculator", $accessoriesMenu, 0) $diskCleanupDialog = GUICtrlCreateMenuItem("Disk Cleanup", $accessoriesMenu, 1) $diskDefragDialog = GUICtrlCreateMenuItem("Disk Defrag", $accessoriesMenu, 2) $notepadAccessoryDialog = GUICtrlCreateMenuItem("Notepad", $accessoriesMenu, 3) $paintDialog = GUICtrlCreateMenuItem("Paint", $accessoriesMenu, 4) $systemInfoDialog = GUICtrlCreateMenuItem("System Information", $accessoriesMenu, 5) $wordpadDialog = GUICtrlCreateMenuItem("Wordpad", $accessoriesMenu, 6) $adminToolsMenu = GUICtrlCreateMenu("Administrative Tools", $ProgramsMenu, 1) $officeMenu = GUICtrlCreateMenu("MS Office", $ProgramsMenu, 2) $excelDialog = GUICtrlCreateMenuItem("Excel", $officeMenu, 0) $wordDialog = GUICtrlCreateMenuItem("Word", $officeMenu, 1) $startUpMenu = GUICtrlCreateMenu("Startup", $ProgramsMenu, 3) $documentsMenu = GUICtrlCreateMenu("Documents", $OptionsContext, 6) $settingsMenu = GUICtrlCreateMenu("Settings", $OptionsContext, 7) $searchDialog = GUICtrlCreateMenuItem("Search", $OptionsContext, 8) $runDialog = GUICtrlCreateMenuItem("Run", $OptionsContext, 9) GUICtrlCreateMenuItem("", $OptionsContext, 10) $lockDialog = GUICtrlCreateMenuItem("Lock", $OptionsContext, 11) $shutdownDialog = GUICtrlCreateMenuItem("Shutdown", $OptionsContext, 12) $clockPos = controlgetpos("xpSkin", "", $xpSkin) $clock = guictrlcreatelabel ("", $clockPos[2] - 50, -1 + 5, BitOr($SS_SIMPLE,$SS_SUNKEN)) $datePos = controlgetpos("", "", $clock) GUICtrlSetTip($clock, _DateTimeFormat( _NowCalc(),1));, $datePos[0] - 5, $datePos[1] - 5) GUICtrlSetColor ($clock, 0x00ff00) ;;;;;;;; ;main() ;;;;;;;; ;windows object properties ; object ; class ; classnamenn ; text ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; ; start ; shell_traywnd ; button1 ; start ; systemTray button ; shell_traywnd ; Button2 ; ; clock; shell_traywnd; trayclockwclass1; ; ; systemTray ; shell_traywnd ; toolbarwindow321 ; notification area ; open windows ; shell_traywnd ; ToolbarWindow322 ; Running Applications ; trash ; Progman ; SysListView321; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; ControlHide ( "ClassName=Progman", "FolderView", "SysListView321") ControlHide ( "ClassName=Shell_TrayWnd", "", "TrayClockWClass1") ControlHide ( "ClassName=Shell_TrayWnd", "", "Button1") ControlHide ( "ClassName=Shell_TrayWnd", "", "Button2") ControlHide ( "ClassName=Shell_TrayWnd", "", "ToolbarWindow321") ControlHide ( "ClassName=Shell_TrayWnd", "", "ToolbarWindow322") ControlHide ( "ClassName=Shell_TrayWnd", "", "") ControlDisable ( "ClassName=Shell_TrayWnd", "", "") #comments-start $var = WinList() For $i = 1 to $var[0][0] ; Only display visble windows that have a title If $var[$i][0] <> "" AND IsVisible($var[$i][1]) Then ;populate title bar here? EndIf Next #comments-end ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;display dialog on top of all windows ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; GUISetState (@SW_SHOW, $xpSkin) winsetontop ("xpSkin", "", 1) While 1 $msg = GUIGetMsg() Select Case $msg = $goButton ShowMenu($xpSkin, $Msg, $OptionsContext) Case $msg = $clock Run(@ComSpec & " /c C:\WINDOWS\system32\timedate.cpl", "", @SW_HIDE) ;quick links Case $msg = $bashDialog Run(@ComSpec & " /T:02 /E:ON /F:ON /K prompt &cls&") sleep(1000) WinSetTitle("C:\WINDOWS\system32\cmd.exe", "", "Bash") sleep(100) WinSetTrans("Bash", "", 150) Case $msg = $ieDialog Run(@ComSpec & " /c """"C:\Program Files\Internet Explorer\IEXPLORE.EXE""""", "", @SW_HIDE) Case $msg = $notepadDialog Run("Notepad.exe") Case $msg = $rdpDialog Run(@ComSpec & " /c """"C:\WINDOWS\system32\mstsc.exe""""", "", @SW_HIDE) ;accessories menu Case $msg = $calculatorDialog Run(@ComSpec & " /c %SystemRoot%\system32\calc.exe","",@SW_HIDE) Case $msg = $diskCleanupDialog Run(@ComSpec & " /c %SystemRoot%\system32\cleanmgr.exe","",@SW_HIDE) Case $msg = $diskDefragDialog Run(@ComSpec & " /c %SystemRoot%\system32\dfrg.msc","",@SW_HIDE) Case $msg = $notepadAccessoryDialog Run("Notepad.exe") Case $msg = $paintDialog Run(@ComSpec & " /c %SystemRoot%\system32\mspaint.exe","",@SW_HIDE) Case $msg = $systemInfoDialog Run("C:\Program Files\Common Files\Microsoft Shared\MSInfo\msinfo32.exe","",@SW_HIDE) Case $msg = $wordpadDialog Run("C:\Program Files\Windows NT\Accessories\wordpad.exe") ;office menu Case $msg = $excelDialog Run("C:\Program Files\Microsoft Office\OFFICE11\EXCEL.EXE") Case $msg = $wordDialog Run("C:\Program Files\Microsoft Office\OFFICE11\WINWORD.EXE") ;other functions Case $msg = $searchDialog Send("#f") Case $msg = $runDialog Send("#r") Case $msg = $lockDialog Send("#l") Case $msg = $shutdownDialog Send("{LWIN}u") EndSelect sleep (1) WEnd ;;;;;;;;;;;;;;;;;;;; ;main gui functions ;;;;;;;;;;;;;;;;;;;; ; Convert the client coordinates to screen coordinates Func ClientToScreen($hWnd, ByRef $x, ByRef $y) Local $stPoint = DllStructCreate("int;int") DllStructSetData($stPoint, 1, $x) DllStructSetData($stPoint, 2, $y) DllCall("user32.dll", "int", "ClientToScreen", "hwnd", $hWnd, "ptr", DllStructGetPtr($stPoint)) $x = DllStructGetData($stPoint, 1) $y = DllStructGetData($stPoint, 2) ; release Struct not really needed as it is a local $stPoint = 0 EndFunc func clockTimer() GUICtrlSetData($clock, @HOUR & ":" & @MIN & ":" & @SEC) endfunc Func IsVisible($handle) If BitAnd( WinGetState($handle), 2 ) Then Return 1 Else Return 0 EndIf EndFunc Func paste() send (clipget()) Return 1 endfunc Func quit() ControlEnable ( "ClassName=Shell_TrayWnd", "", "") Controlshow ( "ClassName=Shell_TrayWnd", "", "") Controlshow ( "ClassName=Shell_TrayWnd", "", "TrayClockWClass1") Controlshow ( "ClassName=Shell_TrayWnd", "", "Button1") Controlshow ( "ClassName=Shell_TrayWnd", "", "Button2") Controlshow ( "ClassName=Shell_TrayWnd", "", "ToolbarWindow321") Controlshow ( "ClassName=Shell_TrayWnd", "", "ToolbarWindow322") Controlshow ( "ClassName=Progman", "", "SysListView321") exit EndFunc ; Show a menu in a given GUI window which belongs to a given GUI ctrl Func ShowMenu($hWnd, $CtrlID, $nContextID) Local $hMenu = GUICtrlGetHandle($nContextID) $arPos = ControlGetPos($hWnd, "", $CtrlID) Local $x = $arPos[0] Local $y = $arPos[1];+ $arPos[3] ClientToScreen($hWnd, $x, $y) TrackPopupMenu($hWnd, $hMenu, $x, $y) EndFunc ; Show at the given coordinates (x, y) the popup menu (hMenu) which belongs to a given GUI window (hWnd) Func TrackPopupMenu($hWnd, $hMenu, $x, $y) DllCall("user32.dll", "int", "TrackPopupMenuEx", "hwnd", $hMenu, "int", 0, "int", $x, "int", $y, "hwnd", $hWnd, "ptr", 0) EndFunc
dabus Posted March 3, 2007 Posted March 3, 2007 I cannot test the code right now, but I think if you want a blackbox, get a blackbox... [ Links ]SourceForge Project Page http://bb4win.sourceforge.netScreenshots http://box.crackmonkey.usFAQ http://bb4win.sourceforge.net/FAQ/FAQ.htmlDocs http://wiki.bb4win.org/More Docs http://snkmchnb.no-ip.com/bbdocs/index.htmlPlugins http://www.desktopian.org/bb/plugins.htmlStyles http://www.ratednc-17.com (and many others...google for "blackbox styles")--------------------------------------------------------[ Branches ]bbLean http://bb4win.sourceforge.net/bblean/Xoblite http://www.desktopian.org/bb/I use bblean with some plugins and I love it. I even think my computer runs faster now.
monte Posted March 3, 2007 Author Posted March 3, 2007 I have used bb4win, bblean, etc. However, I'm a programmer and I want the challenge of doing it myself, in autoit (because it's awesome).
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