Jump to content

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

AHK Window Info 1.7


  • Please log in to reply
82 replies to this topic
sinkfaze
  • Moderators
  • 6367 posts
  • Last active: Nov 30 2018 08:50 PM
  • Joined: 18 Mar 2008
These types of questions belong in Ask for Help. To answer your question:

A_Cursor

vjbnjngn
  • Guests
  • Last active:
  • Joined: --
:roll: :oops: :lol: :O :cry: :arrow: :idea: :?: :!: :evil: :x :? :D :)

  • Guests
  • Last active:
  • Joined: --
A note to the author.

From <!-- m -->http://msdn.microsof... ... 33(v=vs.85<!-- m -->).aspx

An application must not delete a DC whose handle was obtained by calling the GetDC function. Instead, it must call the ReleaseDC function to free the DC

In your script you do exactly that.

trismarck
  • Members
  • 390 posts
  • Last active: Nov 25 2015 12:35 PM
  • Joined: 02 Dec 2010
I have a feature request, could you add an option to display mouse position relative to a control?
something like this:
<!-- m -->http://imageshack.us... ... d01ay.png/<!-- m -->

ruespe
  • Members
  • 567 posts
  • Last active: Dec 01 2014 07:59 PM
  • Joined: 17 Jun 2008
Just replace lines 316-319
Gui, 1:Add, Text, x5 y28 Section, Pos. rel. to Window
      Gui, 1:Add, Edit, x+2 yp-3 w80 vEdtDataMousePosWin,

      Gui, 1:Add, Button, x+28 yp-1 vBtnShowList gBtnShowList -Wrap, % iif(ChkShowList,"<< Less Info","More Info >>")
with this
Gui, 1:Add, Text, x5 y28 Section, PosRel W/C
      Gui, 1:Add, Edit, x+2 yp-3 w70 vEdtDataMousePosWin,
      ; Gui, 1:Add, Text, x145 y28 Section, Control
      Gui, 1:Add, Edit, x+2 yp w70 vEdtDataMousePosCon,

      Gui, 1:Add, Button, x+2 yp-1 vBtnShowList gBtnShowList -Wrap, % iif(ChkShowList,"<< Less Info","More Info >>")
and lines 1216-1228
GetMouseInfo:
  ;get mouse pos relative to windows
  WinGetPos, WindowActiveX, WindowActiveY,,, A
  WinGetPos, WindowX, WindowY,,, ahk_id %MouseWindowUID%
  MouseWindowActiveX := MouseScreenX - WindowActiveX
  MouseWindowActiveY := MouseScreenY - WindowActiveY
  MouseWindowX := MouseScreenX - WindowX
  MouseWindowY := MouseScreenY - WindowY


  GuiControl, 1:, EdtMousePosScreen, x%MouseScreenX% y%MouseScreenY%
  GuiControl, 1:, EdtMousePosWin, x%MouseWindowX% y%MouseWindowY%
  GuiControl, 1:, EdtEasyMousePosWin, x%MouseWindowX% y%MouseWindowY%
  GuiControl, 1:, EdtDataMousePosWin, x%MouseWindowX% y%MouseWindowY%

  GuiControl, 1:, EdtMousePosAWin, x%MouseWindowActiveX% y%MouseWindowActiveY%
with
GetMouseInfo:
  ;get mouse pos relative to windows
  WinGetPos, WindowActiveX, WindowActiveY,,, A
  WinGetPos, WindowX, WindowY,,, ahk_id %MouseWindowUID%
  MouseWindowActiveX := MouseScreenX - WindowActiveX
  MouseWindowActiveY := MouseScreenY - WindowActiveY
  MouseWindowX := MouseScreenX - WindowX
  MouseWindowY := MouseScreenY - WindowY
	MouseControlX := MouseWindowX - ControlX - 1
	MouseControlY := MouseWindowY - ControlY - 1
  GuiControl, 1:, EdtMousePosScreen, x%MouseScreenX% y%MouseScreenY%
  GuiControl, 1:, EdtMousePosWin, x%MouseWindowX% y%MouseWindowY%
  GuiControl, 1:, EdtEasyMousePosWin, x%MouseWindowX% y%MouseWindowY%
  GuiControl, 1:, EdtDataMousePosWin, x%MouseWindowX% y%MouseWindowY%
  GuiControl, 1:, EdtDataMousePosCon, x%MouseControlX% y%MouseControlY%
  GuiControl, 1:, EdtMousePosAWin, x%MouseWindowActiveX% y%MouseWindowActiveY%


Barney9
  • Members
  • 62 posts
  • Last active: Oct 09 2015 09:13 AM
  • Joined: 02 Mar 2007
It seems this script doesnt't work with AHK_L. AHK_L always crashes after some time.

Lexikos
  • Administrators
  • 9844 posts
  • AutoHotkey Foundation
  • Last active:
  • Joined: 17 Oct 2006
I don't have any problems with it.

However, when I ran the script with AutoHotkey Basic or AutoHotkey_L 32-bit on my 64-bit Windows 7 system, it frequently caused explorer.exe to crash. The reason was that it tries to allocate memory in explorer.exe to retrieve information from the Desktop ListView, but the pointer to this memory gets truncated from 64-bit to 32-bit. I worked around this by compiling the script with a 64-bit AutoHotkeySC.bin. (I never saw the script crash, just explorer.exe.)

randallf
  • Members
  • 711 posts
  • Last active: Jan 07 2014 11:45 PM
  • Joined: 06 Jul 2009
Not sure why, but the 'Mouse' tab is EXTREMELY slow to re-draw.

Windows7

fade2gray
  • Members
  • 25 posts
  • Last active: Jul 24 2018 12:08 PM
  • Joined: 21 Oct 2006

Not sure why, but the 'Mouse' tab is EXTREMELY slow to re-draw.

Windows7

You need to disable the Aero theme by changing it to the Basic or, better still, Classic theme.

Would anyone know if it is possible to adapt this script to be compatible with the Aero theme?

Uberi
  • Moderators
  • 1119 posts
  • Last active: May 02 2015 06:05 PM
  • Joined: 23 Aug 2010
Here's a faster version that uses FastPixelGetColor() from around the forums:

Edit: Here's a link to the code since the script is so long.

nimda
  • Members
  • 4368 posts
  • Last active: Aug 09 2015 02:36 AM
  • Joined: 26 Dec 2010

Not sure why, but the 'Mouse' tab is EXTREMELY slow to re-draw.

Windows7

:idea: Gui -Theme

fade2gray
  • Members
  • 25 posts
  • Last active: Jul 24 2018 12:08 PM
  • Joined: 21 Oct 2006

Here's a faster version


Thanks.

cellurl
  • Members
  • 9 posts
  • Last active: Jan 24 2014 04:17 PM
  • Joined: 18 Jul 2012
I need to scrape Windows-Forms.. Sorry to barge in. Will AHK do such? Danke.

guest3456
  • Members
  • 1704 posts
  • Last active: Nov 19 2015 11:58 AM
  • Joined: 10 Mar 2011

A note to the author.

From <!-- m -->http://msdn.microsof... ... 33(v=vs.85<!-- m -->).aspx

An application must not delete a DC whose handle was obtained by calling the GetDC function. Instead, it must call the ReleaseDC function to free the DC

In your script you do exactly that.


in fact, i have seen cases where a script will memory leak if you DONT delete it. i'm talking specifically about a DC obtained from GetDC, not something like CreateCompatibleDC. so microsofts docs are not reliable in this case.

altho the OS probably won't let you delete the DC internally since i highly doubt you can delete DC's from other processes

anyway i might fix this script and update it not only with the fast getpixel but also for windows settings at 120dpi since all the edit boxes are off. plus i find the gui on this thing to be horrible

edit/
oh, i see Uberi's version already fixes the 120dpi, thats makes the gui a lot easier to read

Lexikos
  • Administrators
  • 9844 posts
  • AutoHotkey Foundation
  • Last active:
  • Joined: 17 Oct 2006

altho the OS probably won't let you delete the DC internally since i highly doubt you can delete DC's from other processes

Why not? You can delete bitmaps and icons from other processes, and those are also GDI objects.