AutoHotkey Community

It is currently May 27th, 2012, 4:11 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 73 posts ]  Go to page Previous  1, 2, 3, 4, 5
Author Message
 Post subject:
PostPosted: June 20th, 2009, 5:26 pm 
Offline
User avatar

Joined: September 8th, 2008, 12:26 am
Posts: 1048
Location: Ploieşti, RO
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. :?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 11th, 2010, 6:46 am 
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 ?


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: March 27th, 2011, 5:16 pm 
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



Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: March 27th, 2011, 10:38 pm 
Offline
User avatar

Joined: May 18th, 2010, 3:10 pm
Posts: 1179
Location: Sweden
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]

_________________
~sumon Appifyer AHK Nova halted Recommended: AHK_L (Why?)


Last edited by sumon on March 28th, 2011, 8:39 pm, edited 1 time in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 28th, 2011, 11:37 am 
sumon wrote:
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.

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

Image

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


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: March 28th, 2011, 7:23 pm 
Offline

Joined: April 22nd, 2007, 6:33 pm
Posts: 1833
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 ... 85%29.aspx

and I suggest using that instead


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 8th, 2011, 10:07 am 
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.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: July 8th, 2011, 10:11 am 
Offline
User avatar

Joined: September 8th, 2008, 12:26 am
Posts: 1048
Location: Ploieşti, RO
Heck, that's me above. The &"¤# GPRS modem got disconnected right before posting. First post in (more than) a year and... :(


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 11th, 2011, 1:28 pm 
Offline

Joined: August 11th, 2011, 1:07 pm
Posts: 1
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
}



Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 11th, 2011, 7:13 pm 
Offline
User avatar

Joined: September 8th, 2008, 12:26 am
Posts: 1048
Location: Ploieşti, RO
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 (AHK 1.0.48.05 and Win98SE)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 26th, 2011, 10:58 pm 
Offline

Joined: November 24th, 2008, 7:22 pm
Posts: 73
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 27th, 2011, 6:55 am 
Offline
User avatar

Joined: September 8th, 2008, 12:26 am
Posts: 1048
Location: Ploieşti, RO
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 (AHK 1.0.48.05 and Win98SE)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 27th, 2011, 10:32 am 
Offline

Joined: April 22nd, 2007, 6:33 pm
Posts: 1833
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


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 73 posts ]  Go to page Previous  1, 2, 3, 4, 5

All times are UTC [ DST ]


Who is online

Users browsing this forum: Stigg and 16 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