Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

Stealing Windows StartButton and Clock :)


  • Please log in to reply
7 replies to this topic
HuBa
  • Members
  • 175 posts
  • Last active: Feb 13 2012 09:51 AM
  • Joined: 24 Feb 2007
Now here is a funny script that allows you to move Windows StartButton and Clock onto your Gui window.

A picture says more than thousand words:
Posted Image

It uses "SetParent" Windows API dll call. Another feature is to show the Start menu.

UPDATED: Now the script is more stable, it should work on newer versions of Windows too. However still use it on your risk.

; StealStartButtonAndClock.ahk - Moving Windows controls between windows
;
; Tested with AutoHotkey 1.0.46.10 and Windows XP
; There may be problems on Windows Vista, use it on your risk!
;
; Created by HuBa
; Contact: http://www.autohotkey.com/forum/profile.php?mode=viewprofile&u=4693

ControlGet hStartButton, Hwnd, , Button1, ahk_class Shell_TrayWnd  ; StartButton
ControlGet hClock, Hwnd, , TrayClockWClass1, ahk_class Shell_TrayWnd  ; Clock
hButtonParent := GetParent(hStartButton)  ; Parent of Start button
hClockParent := GetParent(hClock)  ; Parent of Clock

Gui Add, Button, X10 Y90 W180 gShowStartMenu, &Show StartMenu
Gui Add, Button, X10 Y120 W80 gStealButton, Steal &Button
Gui Add, Button, X110 Y120 W80 gRestoreButton, &Restore Button
Gui Add, Button, X10 Y150 W80 gStealClock, Steal &Clock
Gui Add, Button, X110 Y150 W80 gRestoreClock, R&estore Clock
Gui Show, W200 H200, Steal Start button
hGuiWindow := WinExist("ahk_class AutoHotkeyGUI")
Return

ShowStartMenu:
SendMessage 0x112, 0xF130 ;  WM_SYSCOMMAND = 0x112 SC_TASKLIST = 0xF130
Return

StealButton:
if (SetParent(hStartButton, hGuiWindow) = hButtonParent)
  ButtonStealed := True
Return

RestoreButton:
if (SetParent(hStartButton, hButtonParent) = hGuiWindow)
  ButtonStealed := False
Return

StealClock:
if (SetParent(hClock, hGuiWindow) = hClockParent)
  ClockStealed := True
Return

RestoreClock:
if (SetParent(hClock, hClockParent) = hGuiWindow)
  ClockStealed := False
Return

GuiClose:
GuiEscape:
if ButtonStealed
  GoSub RestoreButton
if ClockStealed
  GoSub RestoreClock
ExitApp

GetParent(hControl)
{
  Return DllCall("GetParent", "UInt", hControl)
}

SetParent(hControl, hNewParent)
{
  Return DllCall("SetParent", "UInt", hControl, "UInt", hNewParent)
}


ahklerner
  • Members
  • 1386 posts
  • Last active: Oct 08 2014 10:29 AM
  • Joined: 26 Jun 2006
On Vista, it steals the 'show hidden icons' button instead of the Start button...Then doesn't put it back...

ahklerner
  • Members
  • 1386 posts
  • Last active: Oct 08 2014 10:29 AM
  • Joined: 26 Jun 2006
Actually, it put it under the start button, but it has no functionality now.

OMG...how do I fix my machine....you broke it...

JK....A reboot should suffice.

Grumpy
  • Guests
  • Last active:
  • Joined: --

OMG...how do I fix my machine....you broke it...

Ask a refund, as the software doesn't work as expected...

HuBa
  • Members
  • 175 posts
  • Last active: Feb 13 2012 09:51 AM
  • Joined: 24 Feb 2007
I updated the script!
It should now work on Windows Vista too.


You can restart explorer.exe:
[*:38bbddxu]Press Ctrl+Shift+Esc.
[*:38bbddxu]Click on explorer.exe in processes list.
[*:38bbddxu]End task.
[*:38bbddxu]File menu -> New Task (Run)
[*:38bbddxu]type there "explorer" and RunThis should work in XP, I think it's similar on Vista.

Truckin41
  • Members
  • 11 posts
  • Last active: Dec 12 2007 11:27 PM
  • Joined: 28 Nov 2007
The script works for the Start Button and Clock.. but is there a way to steal/move/duplicate the icons in Systray into my GUI?

HuBa
  • Members
  • 175 posts
  • Last active: Feb 13 2012 09:51 AM
  • Joined: 24 Feb 2007

The script works for the Start Button and Clock.. but is there a way to steal/move/duplicate the icons in Systray into my GUI?

Just replace the "TrayClockWClass1" with this: ToolbarWindow321

Truckin41
  • Members
  • 11 posts
  • Last active: Dec 12 2007 11:27 PM
  • Joined: 28 Nov 2007
Cool, thanks a million!

Truckin