 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
jtuttle
Joined: 06 Nov 2008 Posts: 26
|
Posted: Mon Aug 31, 2009 1:02 am Post subject: How do I move a captionless toolwindow? |
|
|
Lifted straight from the AHK docs:
| Code: | ; Example: On-screen display (OSD) via transparent window:
CustomColor = EEAA99 ; Can be any RGB color (it will be made transparent below).
Gui +LastFound +AlwaysOnTop -Caption +ToolWindow ; +ToolWindow avoids a taskbar button and an alt-tab menu item.
Gui, Color, %CustomColor%
Gui, Font, s32 ; Set a large font size (32-point).
Gui, Add, Text, vMyText cLime, XXXXX YYYYY ; XX & YY serve to auto-size the window.
; Make all pixels of this color transparent and make the text itself translucent (150):
WinSet, TransColor, %CustomColor% 150
SetTimer, UpdateOSD, 200
Gosub, UpdateOSD ; Make the first update immediate rather than waiting for the timer.
Gui, Show, x0 y400 NoActivate ; NoActivate avoids deactivating the currently active window.
return
UpdateOSD:
MouseGetPos, MouseX, MouseY
GuiControl,, MyText, X%MouseX%, Y%MouseY%
return |
I just want to alter this so I can click on it and drag it where I want it, without altering its appearance any. Any ideas? |
|
| Back to top |
|
 |
purloinedheart
Joined: 04 Apr 2008 Posts: 537 Location: Canada
|
Posted: Mon Aug 31, 2009 1:17 am Post subject: |
|
|
| Code: |
; Example: On-screen display (OSD) via transparent window:
CustomColor = EEAA99 ; Can be any RGB color (it will be made transparent below).
Gui +LastFound +AlwaysOnTop -Caption +ToolWindow ; +ToolWindow avoids a taskbar button and an alt-tab menu item.
Gui, Color, %CustomColor%
Gui, Font, s32 ; Set a large font size (32-point).
Gui, Add, Text, vMyText cLime gDrag, XXXXX YYYYY ; XX & YY serve to auto-size the window.
; Make all pixels of this color transparent and make the text itself translucent (150):
WinSet, TransColor, %CustomColor% 150
SetTimer, UpdateOSD, 200
Gosub, UpdateOSD ; Make the first update immediate rather than waiting for the timer.
Gui, Show, x0 y400 NoActivate ; NoActivate avoids deactivating the currently active window.
return
UpdateOSD:
MouseGetPos, MouseX, MouseY
GuiControl,, MyText, X%MouseX%, Y%MouseY%
return
Drag:
PostMessage, 0xA1, 2,,, A
return
|
Wold work 500% better if it wasn't transparent |
|
| Back to top |
|
 |
jtuttle
Joined: 06 Nov 2008 Posts: 26
|
Posted: Mon Aug 31, 2009 7:02 am Post subject: |
|
|
| thanks! |
|
| Back to top |
|
 |
Leef_me
Joined: 08 Apr 2009 Posts: 5336 Location: San Diego, California
|
Posted: Mon Aug 31, 2009 7:28 am Post subject: |
|
|
Borrowed from GDIP.ahk library example #10
http://www.autohotkey.com/forum/viewtopic.php?t=32238
Works in that example, untest by itself
| Code: |
Gui, 2: -Caption +E0x80000 +LastFound +AlwaysOnTop +ToolWindow +OwnDialogs
; Show the window
Gui, 2: Show, NA
; Get a handle to this window we have created in order to update it later
hwnd2 := WinExist()
; By placing this OnMessage here. The function WM_LBUTTONDOWN will be called every time the user left clicks on the gui. This can be used for dragging the image
OnMessage(0x201, "WM_LBUTTONDOWN")
; This is the function to allow the user to drag the image drawn on the screen (this being gui 2)
WM_LBUTTONDOWN()
{
If (A_Gui = 2)
PostMessage, 0xA1, 2
} |
|
|
| Back to top |
|
 |
TLM
Joined: 21 Aug 2006 Posts: 2926 Location: The Shell
|
Posted: Mon Aug 31, 2009 5:32 pm Post subject: |
|
|
In Gui Show add a title then you can move the window based on the title via WinMove.
For and example see the label appmove in myNetstat here:
http://www.autohotkey.com/forum/topic47281.html
| Code: | appMove:
CoordMode, Mouse, Screen
WinGetPos, wOutX, wOutY,,, fgDisplay
WinGetPos,,, bgOutW, bgOuth, bgDisplay
MouseGetPos, mOutX1, mOutY1,
SetWinDelay, -1
Loop,
{
GetKeyState, lmbState, LButton, P
MouseGetPos, mOutX, mOutY,
OutX := mOutX - mOutX1 + wOutX
OutY := mOutY - mOutY1 + wOutY
; This prevents the windows 0 XY coords from jumping to the mouse position when you move it.
WinMove, fgDisplay,, %OutX%, %OutY%
WinMove, bgDisplay,, %OutX%, %OutY%
if (lmbState = "U")
{
SetWinDelay, 100
Break
}
}
Return |
hth _________________
paradigm.shift:=(•_•)┌П┐RTFM||^.*∞ |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|