AutoHotkey Community

It is currently May 26th, 2012, 10:27 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 5 posts ] 
Author Message
PostPosted: August 31st, 2009, 2:02 am 
Offline

Joined: November 6th, 2008, 7:43 pm
Posts: 26
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?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 31st, 2009, 2:17 am 
Offline

Joined: April 4th, 2008, 8:15 pm
Posts: 538
Location: Canada
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 31st, 2009, 8:02 am 
Offline

Joined: November 6th, 2008, 7:43 pm
Posts: 26
thanks!


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 31st, 2009, 8:28 am 
Online

Joined: April 8th, 2009, 7:49 pm
Posts: 6066
Location: San Diego, California
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
}


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 31st, 2009, 6:32 pm 
Offline

Joined: August 21st, 2006, 7:07 pm
Posts: 2925
Location: The Shell
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

_________________
Imageparadigm.shift:=(•_•)┌П┐RTFM||^.*∞


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: AndyJenk, Bing [Bot], JSLover, Leef_me, Miguel, patgenn123, rbrtryn and 71 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group