 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
Drugwash
Joined: 07 Sep 2008 Posts: 921 Location: Ploiesti, RO
|
Posted: Sat Jun 20, 2009 4:26 pm Post subject: |
|
|
Thanks, I'll get rid of it.
Still haven't found a way to move zoomer's window to the corner of the cursor instead of it being centered onto it. Otherwise everything works OK in zoomer, including balloons. No hurry though, I'm still groggy after only 2h of sleep.  |
|
| Back to top |
|
 |
mr.bryce Guest
|
Posted: Sat Sep 11, 2010 5:46 am Post subject: |
|
|
hi everyone,
i m trying to resize the color picker 's window to make it larger.
i tried modifying
| Code: | | WinMove, ahk_id %hWnd%,, xCursor-(nR+1), yCursor-(nR+1), 2*(nR+1), 2*(nR+1) ; 1-pixel border |
but it doesnt work.
i put the last values to 400 for example and i still get a very small color picker window in a vertical rectangle shape.
can anyone help ? |
|
| Back to top |
|
 |
XPuser Guest
|
Posted: Sun Mar 27, 2011 4:16 pm Post subject: |
|
|
This script is one of the greatest but it crashes Windows 7.
How can I modify it to support Win 7?
Thanks.
| tic wrote: |
| Code: | #NoEnv
#SingleInstance, Force
SetWinDelay, 1
nZ := 2.6 ; Zoom Factor
nR := 1 ; Rectangle of the Zoomer
CoordMode, Mouse
CoordMode, Pixel
ToolTip, %A_Space%
WinClose, ahk_class SysShadow
WinGet, hWnd, ID, ahk_class tooltips_class32
WinSet, ExStyle, +0x00000020, ahk_id %hWnd%
hDC_SC := DllCall("GetDC", "Uint", 0)
hDC_TT := DllCall("GetDC", "Uint", hWnd)
Loop
{
MouseGetPos, xmouse, ymouse
DllCall("StretchBlt", "Uint", hDC_TT, "int", 0, "int", 0, "int", nR*2, "int", nR*2, "Uint", hDC_SC, "int", xmouse-nR//nZ, "int", ymouse-nR//nZ, "int", nR//nZ*2, "int", nR//nZ*2, "Uint", 0x00CC0020)
WinMove, ahk_id %hWnd%,, xmouse-nR, ymouse-nR, nR*2, nR*2
WinSet, AlwaysOnTop, On, ahk_id %hWnd%
}
F6::
Exit:
DllCall("ReleaseDC", "Uint", 0, "Uint", hDC_SC)
DllCall("ReleaseDC", "Uint", hWnd, "Uint", hDC_TT)
ExitApp
F12::
If nR < 300
{
nR += 35
}
return
F11::
If nR > 1
{
nR -= 35
}
return |
|
|
|
| Back to top |
|
 |
sumon
Joined: 18 May 2010 Posts: 1014 Location: Sweden
|
Posted: Sun Mar 27, 2011 9:38 pm Post subject: |
|
|
| XPuser wrote: | This script is one of the greatest but it crashes Windows 7.
How can I modify it to support Win 7?
Thanks.
|
http://www.autohotkey.com/forum/viewtopic.php?t=69559
The above script, Colorette, works on Windows 7. If you need the color picking functionability, that is. [Edit: And not magnifying]
Last edited by sumon on Mon Mar 28, 2011 7:39 pm; edited 1 time in total |
|
| Back to top |
|
 |
XPuser Guest
|
Posted: Mon Mar 28, 2011 10:37 am Post subject: |
|
|
Thanks for that link, however I am afraid I am unable to transform that script into a magnifier.
With Sean/Tic's magnifier I get a funny behavior on Win7
The portion of screen being magnified is positioned on the line between the mouse pointer and the magnifier window depending on the zoom factor... like in a homothecy.
I hope there is a fix for that.. this script is the one I can't make work on Win 7 by myself |
|
| Back to top |
|
 |
tic
Joined: 22 Apr 2007 Posts: 1786
|
Posted: Mon Mar 28, 2011 6:23 pm Post subject: |
|
|
I haven't looked at which code you are refering to, but things to note in win7 and vista are that you have a limit to the size of a tooltip, which was not a limitation on xp, so if using a tooltip as the gui, that needs to be created as a layered window....however.....capturing the screen using GetDC and BitBlt will not work as win7 and vista will capture your layered window as well making it impossible to capture what is underneath your window....I have come up with convoluted ways to get round this, but think that this is unnecessary as the magnification api can deal with this
http://msdn.microsoft.com/en-us/library/ms692162%28v=VS.85%29.aspx
and I suggest using that instead |
|
| Back to top |
|
 |
Guest
|
Posted: Fri Jul 08, 2011 9:07 am Post subject: |
|
|
Actually there doesn't seem to be a size limit for a tooltip in Vista/7, but rather a resizing limitation: a tooltip will never be expanded beyond the initial width and height set upon creation, however it can be shrinked.
I've hit that wall in SmartGUI Creator Mod (a user reported this "bug" in the Group Selection routine) and the only quickfix I could find at the time was to create a really huge tooltip containing a bucketfull of tab characters Chr(7), tooltip that would later on be shrinked to the desired size, from then on allowing any resize operation between 0x0 and the initial creation size. |
|
| Back to top |
|
 |
Drugwash
Joined: 07 Sep 2008 Posts: 921 Location: Ploiesti, RO
|
Posted: Fri Jul 08, 2011 9:11 am Post subject: |
|
|
Heck, that's me above. The &"¤# GPRS modem got disconnected right before posting. First post in (more than) a year and...  |
|
| Back to top |
|
 |
Hedbänger
Joined: 11 Aug 2011 Posts: 1
|
Posted: Thu Aug 11, 2011 12:28 pm Post subject: |
|
|
Hi, I modified it, so if your mouse location is near screen border, the target window don't move ... and it was drawing above of the mouse, if you are in the lower screen area ...
I think, this is very useful, if you are a few meters away from your screen and want to cotrol anything with your remote controlled keyboard or mouse ...
PS.: I have only adapt the Magnifier function ...
| Code: |
/*
1)
Ctrl+Shift+Z starts new color zoomer, i.e., can have multiple balloon windows.
LeftClick picks the color.
Shift+LeftClick cancels the color zoomer.
Esc or RightClick close the active balloon window.
Shift+Esc or Shift+RightClick close the active balloon window, after copying the color to the clipboard.
Ctrl+Alt+Shift closes all the balloon windows.
Also may use Alt+Space, i.e. SysMenu.
2)
Ctrl+Shift+A starts the magnifier.
Ctrl+Shift+Q starts the magnifier, with Color-Inversion.
Esc closes the magnifier.
*/
#NoEnv
SetWinDelay, 10
CoordMode, Mouse
DetectHiddenWindows, On
^+A::Magnifier()
^+Q::Magnifier(1)
^+Z::Zoomer()
#IfWinActive, ahk_group Balloons
+Esc::
+RButton::
Clipboard := GetColor()
~RButton Up::
~Esc::GroupClose, Balloons, R
#IfWinActive
^!Shift::GroupClose, Balloons, A
Zoomer()
{
nZ := 6 ; Zoom Factor
nR := 108//2//nZ*nZ - 1 ; Rectangle of the Zoomer
VarSetCapacity(nColor,63)
nColor := A_Space
VarSetCapacity(ti, 40, 0)
ti := Chr(40)
DllCall("ntdll\RtlFillMemoryUlong", "Uint", &ti + 4, "Uint", 4, "Uint", 0x20)
DllCall("ntdll\RtlFillMemoryUlong", "Uint", &ti +36, "Uint", 4, "Uint", &nColor)
hWnd := DllCall("CreateWindowEx", "Uint", 0x08000008, "str", "tooltips_class32", "str", "", "Uint", 0x3, "int", 0, "int", 0, "int", 0, "int", 0, "Uint", 0, "Uint", 0, "Uint", 0, "Uint", 0)
DllCall("SetClassLong", "Uint", hWnd, "int", -12, "int", DllCall("LoadCursor", "Uint", 0, "Uint", 32515))
SendMessage, 1028, 0, &ti,, ahk_id %hWnd%
SendMessage, 1041, 1, &ti,, ahk_id %hWnd%
SendMessage, 1036, 0, &ti,, ahk_id %hWnd%
hDC_SC := DllCall("GetDC", "Uint", 0)
hDC_TT := DllCall("GetDC", "Uint", hWnd)
Loop
{
MouseGetPos, xCursor, yCursor
DllCall("StretchBlt", "Uint", hDC_TT, "int", 0, "int", 0, "int", 2*nR, "int", 2*nR, "Uint", hDC_SC, "int", xCursor-nR//nZ, "int", yCursor-nR//nZ, "int", 2*nR//nZ, "int", 2*nR//nZ, "Uint", 0x00CC0020)
WinMove, ahk_id %hWnd%,, xCursor-(nR+1), yCursor-(nR+1), 2*(nR+1), 2*(nR+1) ; 1-pixel border
If GetKeyState("LButton")
Break
}
nColor := DllCall("GetPixel", "Uint", hDC_SC, "int", xCursor, "int", yCursor)
DllCall("ReleaseDC", "Uint", 0, "Uint", hDC_SC)
DllCall("ReleaseDC", "Uint", hWnd, "Uint", hDC_TT)
DllCall("SetClassLong", "Uint", hWnd, "int", -12, "int", DllCall("LoadCursor", "Uint", 0, "Uint", 32512))
If GetKeyState("Shift")
{
WinClose, ahk_id %hWnd%
Return
}
WinSet, ExStyle, -0x08000000, ahk_id %hWnd%
WinSet, Style, -0x00800000, ahk_id %hWnd%
WinSet, Style, +0x000800C0, ahk_id %hWnd%
SendMessage, 1042, 0, (xCursor & 0xFFFF) | (yCursor & 0xFFFF) << 16,, ahk_id %hWnd%
SendMessage, 1043, nColor, 0,, ahk_id %hWnd%
SendMessage, 1044,~nColor & 0xFFFFFF, 0,, ahk_id %hWnd%
pt := "Color @(" . xCursor . "," . yCursor . ")"
DllCall("wsprintf", "str", nColor, "str", " 0x%06X (#BBGGRR) ", "Uint", nColor, "Cdecl")
SendMessage, 1056, 0, &pt,, ahk_id %hWnd%
SendMessage, 1036, 0, &ti,, ahk_id %hWnd%
GroupAdd, Balloons, ahk_id %hWnd%
}
Magnifier(bInvert = False)
{
nZ := 3 ; Zoom Factor
nW := A_ScreenWidth // 5 //2//nZ ; Width of (small) Target Rectangle
nH := A_ScreenHeight// 5 //2//nZ ; Height of (small) Target Rectangle
screenVMiddle := A_ScreenHeight // 2
screenHMiddle := A_ScreenWidth // 2
CorOverMouse := (nH*nZ)+(nH) ; any value you like ;-)
CorBesideMouse:= (nW*nZ)+(nW) ; any value you like ;-)
ToolTip, %A_Space% ;Creates an always-on-top window anywhere on the screen
WinGet, hWnd, ID, ahk_class tooltips_class32 ;Retrieves the specified window's unique ID
WinClose, ahk_class SysShadow ;Comment it out to have the DropShadow
hDC_SC := DllCall("GetDC", "Uint", 0) ;retrieves a handle to a device context (DC) If the value is NULL, GetDC retrieves the DC for the entire screen
hDC_LW := DllCall("GetDC", "Uint", hWnd) ;retrieves a handle to a device context (DC) for the client area of a specified window
hDC_TT := DllCall("GetDC", "Uint", hWnd) ;retrieves a handle to a device context (DC) for the client area of a specified window
DllCall("SetStretchBltMode", "Uint", hDC_TT, "int", 4) ;sets the bitmap stretching mode
Loop
{
MouseGetPos, xCursor, yCursor
;------------------ Source Window ---------------------------
ySRC := yCursor-nH
if ((yCursor-nH) < 0)
ySRC := 0 ;upper border
if (yCursor+nH > A_ScreenHeight)
ySRC := A_ScreenHeight-2*nH ;lower border
xSRC := xCursor-nW
if ((xCursor-nW) < 0)
xSRC := 0 ;upper border
if (xCursor+nW > A_ScreenWidth)
xSRC := A_ScreenWidth-2*nW ;lower border
If bInvert
DllCall("BitBlt", "Uint", hDC_LW, "int", 0, "int", 0, "int", 2*nW, "int", 2*nH, "Uint", 0, "int", 0, "int", 0, "Uint", 0x00550009)
else
DllCall("BitBlt", "Uint", hDC_LW, "int", 0, "int", 0, "int", 2*nW, "int", 2*nH, "Uint", hDC_SC, "int", xSRC, "int", ySRC, "Uint", 0x40CC0020)
;------------------ Mouse Bitmap drawing ---------------------
yMaus := nH
if ((yCursor-nH) < 0)
yMaus := yCursor ;use coordinates for moving in upper area
if ((yCursor+nH) > A_ScreenHeight)
yMaus := yCursor-A_ScreenHeight+2*nH ;use coordinates for moving in lower area
xMaus := nW
if ((xCursor-nW) < 0)
xMaus := xCursor ;use coordinates for moving in upper area
if ((xCursor+nW) > A_ScreenWidth)
xMaus := xCursor-A_ScreenWidth+2*nW ;use coordinates for moving in lower area
Cursor(hDC_LW, xMaus, yMaus) ; Capture magnified mouse cursor.
;StretchBlt function copies a bitmap from a source rectangle into a destination rectangle
DllCall("StretchBlt", "Uint", hDC_TT, "int", 0, "int", 0, "int", 2*nW*nZ, "int", 2*nH*nZ, "Uint", hDC_LW, "int", 0, "int", 0, "int", 2*nW, "int", 2*nH, "Uint", 0x00CC0020)
; Cursor(hDC_TT, nW*nZ, nH*nZ) ; Capture un-magnified mouse cursor.
;------------------ Move destination Window -------------------
yPosOverWin := CorOverMouse ;correction value for Win above Mouse
if (yCursor>screenVMiddle)
yPosOverWin := -CorOverMouse
yPosWin := yCursor - (nH*nZ) + yPosOverWin
if (yPosWin-CorOverMouse < 0)
yPosWin := CorOverMouse
if ((yPosWin +(2*nH*nZ)+ CorOverMouse) > A_ScreenHeight)
yPosWin := A_ScreenHeight-(2*nH*nZ)-CorOverMouse
xPosBisideWin := CorBesideMouse ;correction value for Win beside Mouse
if (xCursor>screenHMiddle)
xPosBisideWin := -CorBesideMouse
xPosWin := xCursor - (nW*nZ) + xPosBisideWin
if ((xPosWin-CorBesideMouse) < 0)
xPosWin := CorBesideMouse
if ((xPosWin+(2*nW*nZ)+CorBesideMouse) > A_ScreenWidth)
xPosWin := A_ScreenWidth-(2*nW*nZ)-CorBesideMouse
WinMove, ahk_id %hWnd%,, xPosWin, yPosWin, 2*(nW*nZ+1), 2*(nH*nZ+1)
If GetKeyState("Esc")
Break
}
DllCall("ReleaseDC", "Uint", 0, "Uint", hDC_SC)
DllCall("ReleaseDC", "Uint", hWnd, "Uint", hDC_LW)
DllCall("ReleaseDC", "Uint", hWnd, "Uint", hDC_TT)
WinClose, ahk_id %hWnd%
}
Cursor(hDC, xCenter, yCenter)
{
VarSetCapacity(mi, 20, 0) ;Enlarges a variable's holding capacity or frees its memory
mi := Chr(20) ;Returns the single character corresponding to the ASCII code indicated by Number
DllCall("GetCursorInfo", "Uint", &mi)
ptr := &mi + 4
bShow := *ptr++ | *ptr++ << 8 | *ptr++ << 16 | *ptr++ << 24
hCursor := *ptr++ | *ptr++ << 8 | *ptr++ << 16 | *ptr++ << 24
DllCall("GetIconInfo", "Uint", hCursor, "Uint", &mi)
ptr := &mi + 4
xHotspot := *ptr++ | *ptr++ << 8 | *ptr++ << 16 | *ptr++ << 24
yHotspot := *ptr++ | *ptr++ << 8 | *ptr++ << 16 | *ptr++ << 24
hBMMask := *ptr++ | *ptr++ << 8 | *ptr++ << 16 | *ptr++ << 24
hBMColor := *ptr++ | *ptr++ << 8 | *ptr++ << 16 | *ptr++ << 24
DllCall("DeleteObject", "Uint", hBMMask)
DllCall("DeleteObject", "Uint", hBMColor)
If bShow
DllCall("DrawIcon", "Uint", hDC, "int", xCenter - xHotspot, "int", yCenter - yHotspot, "Uint", hCursor)
}
GetColor()
{
VarSetCapacity(nColor, 8)
SendMessage, 1046, 0, 0,, A
DllCall("wsprintf", "str", nColor, "str", "0x%06X", "Uint", ErrorLevel, "Cdecl")
Return nColor
}
|
|
|
| Back to top |
|
 |
Drugwash
Joined: 07 Sep 2008 Posts: 921 Location: Ploiesti, RO
|
Posted: Thu Aug 11, 2011 6:13 pm Post subject: |
|
|
In Color Inversion mode, there must be a bug because the magnifier window starts flashing black/white and stays that way. Please revise the code. _________________ AHK tools by Drugwash |
|
| Back to top |
|
 |
Relayer
Joined: 24 Nov 2008 Posts: 68
|
Posted: Fri Aug 26, 2011 9:58 pm Post subject: |
|
|
Hi,
Just moved to win 7 and got all the magnification stuff working but the balloon tips are just a black blob. I am so impressed with the way they look on XP. Any ideas?
Relayer |
|
| Back to top |
|
 |
Drugwash
Joined: 07 Sep 2008 Posts: 921 Location: Ploiesti, RO
|
Posted: Sat Aug 27, 2011 5:55 am Post subject: |
|
|
Not sure if this is the problem here, but in the past I've stumbled into similar issue; thing is, Win7 (probably Vista too and everything else after XP, for that matter) doesn't allow a tooltip window to grow beyond the size that's been created at. It only allows it to shrink. Therefore, if one creates a blank tooltip window with the intention of later on enlarging it as needed, will be in for a big surprise on these shiny new Windows versions. Thank Microsoft for this "improvement".
A possible fix would be to first create the tooltip at maximum size A_ScreenWidth x A_ScreenHeight (filling it with tab characters until it blows up).
Ah, scratch that, I didn't wake up completely - you were talking about balloon tips, not tooltips. Sorry! Anyway, the information might be of some use for somebody, sometime. _________________ AHK tools by Drugwash |
|
| Back to top |
|
 |
tic
Joined: 22 Apr 2007 Posts: 1786
|
Posted: Sat Aug 27, 2011 9:32 am Post subject: |
|
|
| Regardless of the type of window....aero will mean that any "hover" magnifier will capture itself. You could capture the hwnds of all the windows and draw them, but it is easier to just use the magnification api |
|
| 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
|