WinSpy - Window Information Tool

Post your working scripts, libraries and tools for AHK v1.1 and older
BoBo
Posts: 6564
Joined: 13 May 2014, 17:15

Re: WinSpy - Window Information Tool

02 Dec 2017, 12:09

playthegammee wrote:This tool picks up elements in programs that other tools dont. Thank you!

In Python there is a tool that generates code https://www.youtube.com/watch?v=xaMFHOq_Hls

If you plan on expanding it one idea would be to let users generate the AHK code.

So for example, if I do a send message, or remove or add style maybe we can generate the code behind it speeding things up for development.
That's cool stuff bc :arrow: PyWinAuto is offering to automate things on Linux too :thumbup:
Georgie Munteer

Re: WinSpy - Window Information Tool

02 Dec 2017, 13:49

BoBo wrote:
playthegammee wrote:This tool picks up elements in programs that other tools dont. Thank you!

In Python there is a tool that generates code https://www.youtube.com/watch?v=xaMFHOq_Hls

If you plan on expanding it one idea would be to let users generate the AHK code.

So for example, if I do a send message, or remove or add style maybe we can generate the code behind it speeding things up for development.
That's cool stuff bc :arrow: PyWinAuto is offering to automate things on Linux too :thumbup:
had no clue they have it for linux

also see this, maybe the maker of this software can add

https://autohotkey.com/boards/viewtopic.php?f=5&t=40796

So I am using autogui and I checked out the Constantine tool. So many options, and the only way to visualize them is to see samples.

Is there a tool that shows samples of the different styles as you select them?
User avatar
Alguimist
Posts: 428
Joined: 05 Oct 2015, 16:41
Contact:

Re: WinSpy - Window Information Tool

02 Dec 2017, 19:03

Georgie Munteer wrote:Is there a tool that shows samples of the different styles as you select them?
Styles of windows/controls can be changed with WinSpy. There's also a tool from Microsoft called ControlSpy, but the download link seems to be unavailable. You should be able to use AutoGUI as well because the options menu for controls are restricted to the most commonly used, apart from a complete list of styles.
Progprog

Re: WinSpy - Window Information Tool

05 Dec 2017, 07:06

when you select the Commands button and then un-check Visible, what code do you use to make that window not visible?
User avatar
Alguimist
Posts: 428
Joined: 05 Oct 2015, 16:41
Contact:

Re: WinSpy - Window Information Tool

05 Dec 2017, 12:05

Progprog wrote:when you select the Commands button and then un-check Visible, what code do you use to make that window not visible?
This is the code in use to toggle the visibility:

Code: Select all

ShowWindow(g_hWnd, !IsWindowVisible(g_hWnd))
ShowWindow and IsWindowVisible are wrappers to Windows functions with the same name:

Code: Select all

ShowWindow(hWnd, nCmdShow := 1) {
    DllCall("ShowWindow", "Ptr", hWnd, "Int", nCmdShow)
}

IsWindowVisible(hWnd) {
    Return DllCall("IsWindowVisible", "Ptr", hWnd)
}
Progprog

Re: WinSpy - Window Information Tool

05 Dec 2017, 16:53

Alguimist wrote:
Progprog wrote:when you select the Commands button and then un-check Visible, what code do you use to make that window not visible?
This is the code in use to toggle the visibility:

Code: Select all

ShowWindow(g_hWnd, !IsWindowVisible(g_hWnd))
ShowWindow and IsWindowVisible are wrappers to Windows functions with the same name:

Code: Select all

ShowWindow(hWnd, nCmdShow := 1) {
    DllCall("ShowWindow", "Ptr", hWnd, "Int", nCmdShow)
}

IsWindowVisible(hWnd) {
    Return DllCall("IsWindowVisible", "Ptr", hWnd)
}
so say I have a window with a title of Trainer Schedule that I want to hide, how would I do that using your method, the regular winhide method does not work for me :`-( yet when I drag the cross hairs from your program over my program and unchecked visible it works great
User avatar
Alguimist
Posts: 428
Joined: 05 Oct 2015, 16:41
Contact:

Re: WinSpy - Window Information Tool

05 Dec 2017, 18:00

WinHide also works, just make sure that you can uniquely identify the window using a matching criteria. See WinTitle for examples (Title, ahk_class, ahk_exe).
SOTE
Posts: 1426
Joined: 15 Jun 2015, 06:21

Re: WinSpy - Window Information Tool

21 Dec 2017, 22:26

WinSpy is an updated improvement in AutoHotkey code, but was looking for something more similar to Winspector, which gives the information on windows messages. It appears that this WinSpy simply allows you to test for a specific one, as oppose to finding out what they are when you don't know them and what parameters to use.
User avatar
Alguimist
Posts: 428
Joined: 05 Oct 2015, 16:41
Contact:

Re: WinSpy - Window Information Tool

22 Dec 2017, 15:37

It is a planned feature. The monitoring of messages with SetWindowsHookEx requires a DLL (error 1428: cannot set nonlocal hook without a module handle) that I have yet to produce.
User avatar
jeeswg
Posts: 6902
Joined: 19 Dec 2016, 01:58
Location: UK

Re: WinSpy - Window Information Tool

22 Dec 2017, 16:56

One possibility: AHK v1.1 + AutoHotkeyMini.dll + InjectAhkDll function:
[prototype window spy]
how to dll Inject - AutoHotkey Community
https://autohotkey.com/boards/viewtopic ... 82#p166682
[a variant of InjectAhkDll which does not require _Struct.ahk]
how to dll Inject - Page 2 - AutoHotkey Community
https://autohotkey.com/boards/viewtopic ... 80#p171580
[get x64 and x32 versions of AutoHotkeyMini.dll]
GitHub - HotKeyIt/ahkdll-v1-release: AutoHotkey_H v1 release
https://github.com/HotKeyIt/ahkdll-v1-release
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
User avatar
Alguimist
Posts: 428
Joined: 05 Oct 2015, 16:41
Contact:

Re: WinSpy - Window Information Tool

22 Dec 2017, 21:45

@jeeswg: I couldn't get your code to work.

I have been examining the source code of Window Detective. It uses a small DLL called WD_Hook.dll to monitor messages. Here is an excerpt of Hook.cpp:

Code: Select all

/*--------------------------------------------------------------------------+
| Installs the hook procedure into the hook chain.                          |
+--------------------------------------------------------------------------*/
DWORD InstallHook() {
    // Hook for calling window procedure
    callWndHook = SetWindowsHookEx(WH_CALLWNDPROC, CallWndProc, dllInstance, 0);
    if (!callWndHook) return GetLastError();

    // Hook for returning from window procedure call
    callWndRetHook = SetWindowsHookEx(WH_CALLWNDPROCRET, CallWndRetProc, dllInstance, 0);
    if (!callWndRetHook) return GetLastError();

    // Hook for getting a message off the queue
    getMsgHook = SetWindowsHookEx(WH_GETMESSAGE, GetMsgProc, dllInstance, 0);
    if (!getMsgHook) return GetLastError();
    
    return S_OK;
}
SOTE
Posts: 1426
Joined: 15 Jun 2015, 06:21

Re: WinSpy - Window Information Tool

23 Dec 2017, 02:01

Alguimist wrote:It is a planned feature. The monitoring of messages with SetWindowsHookEx requires a DLL (error 1428: cannot set nonlocal hook without a module handle) that I have yet to produce.
Glad to see there will be updates. Would humbly suggest taking a look at API Monitor ( http://www.rohitab.com/downloads ). It can decode WM_Messages to hex and decimal to hex, for a PostMessage and SendMessage ready format. It might give some ideas. A pure AutoHotkey solution would be preferable.
User avatar
Alguimist
Posts: 428
Joined: 05 Oct 2015, 16:41
Contact:

Re: WinSpy - Window Information Tool

08 Sep 2018, 05:59

Version 1.0.3:
• Much more information about Scintilla controls is displayed in the Extra tab.
• Minor bug fixes.

:arrow: See the initial post for the download link and a detailed description of all features.
DRocks
Posts: 565
Joined: 08 May 2018, 10:20

Re: WinSpy - Window Information Tool

10 Sep 2018, 06:34

thanks for the update!
DRocks
Posts: 565
Joined: 08 May 2018, 10:20

Re: WinSpy - Window Information Tool

26 Oct 2018, 05:29

Hello Alguimist, for the first time Windows10 antimalware started detecting a trojan when executing WinSpy? I've been using it for the last year and now they say its not safe... any clue what could make it say that?
robodesign
Posts: 934
Joined: 30 Sep 2017, 03:59
Location: Romania
Contact:

Re: WinSpy - Window Information Tool

26 Oct 2018, 16:52

That's what windows says about compiled binaries with AHK for the past few months...... I submitted a few binaries to Microsoft and marked as not malware, but still insists on it ....
-------------------------
KeyPress OSD v4: GitHub or forum. (presentation video)
Quick Picto Viewer: GitHub or forum.
AHK GDI+ expanded / compilation library (on GitHub)
My home page.
Bensley
Posts: 6
Joined: 18 Nov 2017, 06:18

Re: WinSpy - Window Information Tool

29 Oct 2018, 04:17

I think to completely replace all other similar tools you should add an option that uses active window as a default window to extract information from and real time mouse position (screen and Awindow coordinates).
It would be practical for cases when you need something basic, which in my case is 90+% of the time :D
Just a thought.
User avatar
Alguimist
Posts: 428
Joined: 05 Oct 2015, 16:41
Contact:

Re: WinSpy - Window Information Tool

30 Jan 2019, 22:33

DRocks wrote:
26 Oct 2018, 05:29
Hello Alguimist, for the first time Windows10 antimalware started detecting a trojan when executing WinSpy? I've been using it for the last year and now they say its not safe... any clue what could make it say that?
If this occurs, run WinSpy from the script, which is in the same folder of the executables.
Bensley wrote:
29 Oct 2018, 04:17
I think to completely replace all other similar tools you should add an option that uses active window as a default window to extract information from and real time mouse position (screen and Awindow coordinates).
Mouse position (relative to screen, window, client) is displayed in WinSpy when you move the drag tool, except in Compact Mode. As for the way by which a window/control is selected, I am convinced that the drag-and-release approach is more convenient: it doesn't require the target window to be active and the press of a key to freeze that information in the display.
SOTE
Posts: 1426
Joined: 15 Jun 2015, 06:21

Re: WinSpy - Window Information Tool

30 Jan 2019, 23:23

Alguimist wrote:
30 Jan 2019, 22:33
DRocks wrote:
26 Oct 2018, 05:29
Hello Alguimist, for the first time Windows10 antimalware started detecting a trojan when executing WinSpy? I've been using it for the last year and now they say its not safe... any clue what could make it say that?
If this occurs, run WinSpy from the script, which is in the same folder of the executables.
Bensley wrote:
29 Oct 2018, 04:17
I think to completely replace all other similar tools you should add an option that uses active window as a default window to extract information from and real time mouse position (screen and Awindow coordinates).
Mouse position (relative to screen, window, client) is displayed in WinSpy when you move the drag tool, except in Compact Mode. As for the way by which a window/control is selected, I am convinced that the drag-and-release approach is more convenient: it doesn't require the target window to be active and the press of a key to freeze that information in the display.
I think it might be possible that non-experts or laymen see the word "spy" in the name of your software and false flag it. Then lazy anti-virus or malware companies put your software on their list. Various other bigger companies copy those lists, and tag the software too. A very bad circle jerk happens, where software that should not be on malware lists, get put on. And if Google gets a hold of your software name on such a list, they exponentially make the problem worse, by putting your software and/or website on their blacklist (which they are very reluctant to take off).

The only way to counter this is to report this false flagging and false positives to the bigger companies, Microsoft being one of them. When reported to Microsoft as a false positive, their experts see that and take your software off their lists. I've actually seen various version of Windows Defender, tag the software as malware, and then subsequently versions not do so. Clearly, there is some flawed mechanism at work, where the program repeatedly gets put on and then taken off their lists. I can say that reporting false positives to Microsoft does work, for specific versions of software released. If an updated version of software is made, people might need to resubmit their software again to Microsoft for analysis.

To report a false positive to Microsoft, everyone can help by doing this-

https://www.microsoft.com/en-us/wdsi/filesubmission
(Report False Positives To Microsoft Or Submit Software For Analysis)

If a "Home Customer" select that.
Select "Continue".
You don't have to sign in, so can press "Skip"
At the Submit A File screen

Code: Select all

Do you believe this file contains malware?

No — this file has been incorrectly detected

And select the file you wish to submit
ruespe
Posts: 26
Joined: 09 Nov 2013, 04:47

Re: WinSpy - Window Information Tool

31 Jan 2019, 14:48

Alguimist wrote:
30 Jan 2019, 22:33
Mouse position (relative to screen, window, client) is displayed in WinSpy when you move the drag tool, except in Compact Mode. As for the way by which a window/control is selected, I am convinced that the drag-and-release approach is more convenient: it doesn't require the target window to be active and the press of a key to freeze that information in the display.
Great little tool, thanks for sharing. Unfortunately in my case WinSpy shows the same cursor-position in Windows-mode as well as in Client-mode (shouldn't it be "Control-mode"?). In both cases the mouse position related to the control is shown.

And why not show all three cursor positions side-by-side instead of heaving to switch every time?

ruespe

Return to “Scripts and Functions (v1)”

Who is online

Users browsing this forum: JoeWinograd, TOTAL and 140 guests