Author Topic: New tool/toy for getting a window's class name  (Read 6098 times)

hutch--

  • Administrator
  • Member
  • ******
  • Posts: 7541
  • Mnemonic Driven API Grinder
    • The MASM32 SDK
New tool/toy for getting a window's class name
« on: September 09, 2014, 10:39:16 PM »
While most of the old timers know how to get the class name of an application and there are a number of ways of doing it, as I have been working on a Sendkeys system recently there was not a dedicated tool to get this name which is necessary for locating the target to send keys to. It was a typical tiny app even with a manifest and version control block so I added an icon in RGBA in 3 resolutions that was 3 times the size of the executable so now its a bloated 20k application.  :biggrin:

Its a click and drag style application, gives reasonable visual feedback as to what is being targetted and seems to work OK. Only tested in my Win7 64 bit box.
hutch at movsd dot com
http://www.masm32.com    :biggrin:  :skrewy:

TouEnMasm

  • Member
  • *****
  • Posts: 1342
    • EditMasm
Re: New tool/toy for getting a window's class name
« Reply #1 on: September 10, 2014, 01:52:12 AM »
It work on xp SP3
Fa is a musical note to play with CL

Gunther

  • Member
  • *****
  • Posts: 3585
  • Forgive your enemies, but never forget their names
Re: New tool/toy for getting a window's class name
« Reply #2 on: September 10, 2014, 02:14:27 AM »
Steve,

works fine under Windows 7-64.

Gunther
Get your facts first, and then you can distort them.

Siekmanski

  • Member
  • *****
  • Posts: 2330
Re: New tool/toy for getting a window's class name
« Reply #3 on: September 10, 2014, 02:53:24 AM »
Works under Windows 8.1 64bit
Creative coders use backward thinking techniques as a strategy.

MichaelW

  • Global Moderator
  • Member
  • *****
  • Posts: 1209
Re: New tool/toy for getting a window's class name
« Reply #4 on: September 10, 2014, 08:30:08 AM »
It works under Windows7-64, but if the target window is above some other window, an Explorer window for example, and to get the cursor to the target window you drag it over the other window (and depending on the size and positioning of the two windows there may be no other way), the other window will be brought to the foreground, obscuring the target window.
Well Microsoft, here’s another nice mess you’ve gotten us into.

Zen

  • Member
  • ****
  • Posts: 962
  • slightly red-shifted
Re: New tool/toy for getting a window's class name
« Reply #5 on: September 10, 2014, 09:25:43 AM »
GOOD.
Microsoft Windows 7 Professional 64-bit
...Like MICHAEL, above,...it took me several tries to get the hang of it,...possibly, it's optimized for Southern Hemisphere users,...
Zen

hutch--

  • Administrator
  • Member
  • ******
  • Posts: 7541
  • Mnemonic Driven API Grinder
    • The MASM32 SDK
Re: New tool/toy for getting a window's class name
« Reply #6 on: September 10, 2014, 11:30:19 AM »
The effect is due to a requirement of the API "WindowFromPoint()" that it will only identify a window that is not hidden or disabled. The "SetForegroundWindow()" API gives you some idea of which window is being identified and the "GetClassName()" does the rest to get the class name string. As its an occasional tool its probably OK to have to bother to tidy up the desktop enough so that the target window is not covered by a larger window.

> possibly, it's optimized for Southern Hemisphere users

Yeah, you have to watch those penguins, they probably run Linux.
hutch at movsd dot com
http://www.masm32.com    :biggrin:  :skrewy:

Grincheux

  • Member
  • ***
  • Posts: 330
  • Never be pleased, Always improve
    • Asm for fun
Re: New tool/toy for getting a window's class name
« Reply #7 on: December 07, 2015, 06:29:52 AM »
Works on W10 PRO 64 bits
Kenavo (Bye)
----------------------
Asm for Fun
My Links
"La garde meurt mais ne rend pas"
Cambronne à Waterloo

Grincheux

  • Member
  • ***
  • Posts: 330
  • Never be pleased, Always improve
    • Asm for fun
Re: New tool/toy for getting a window's class name
« Reply #8 on: December 07, 2015, 06:34:09 AM »
Code: [Select]
HWND WINAPI FindWindow(
  _In_opt_ LPCTSTR lpClassName,
  _In_opt_ LPCTSTR lpWindowName
);

int WINAPI GetClassName(
  _In_  HWND   hWnd,
  _Out_ LPTSTR lpClassName,
  _In_  int    nMaxCount
);
Why to make this tool? Or I have not understood something. I am not 'Blonde'.
Kenavo (Bye)
----------------------
Asm for Fun
My Links
"La garde meurt mais ne rend pas"
Cambronne à Waterloo

hutch--

  • Administrator
  • Member
  • ******
  • Posts: 7541
  • Mnemonic Driven API Grinder
    • The MASM32 SDK
Re: New tool/toy for getting a window's class name
« Reply #9 on: December 07, 2015, 11:15:45 AM »
Try again, I hit the wrong key and closed the browser.  :redface:

The main use is for external apps that don't have access to the called app's address space. Get the class name and you can use FindWindow() to get its window handle and subsequent menu handle. Then you can send keystrokes to the called app. In my case it was so I could quickly reset Winfile.exe which depends on OS settings and every time some installation or upgrade altered the OS settings, it messed up my Winfile settings.
hutch at movsd dot com
http://www.masm32.com    :biggrin:  :skrewy:

Grincheux

  • Member
  • ***
  • Posts: 330
  • Never be pleased, Always improve
    • Asm for fun
Re: New tool/toy for getting a window's class name
« Reply #10 on: December 07, 2015, 01:32:12 PM »
Just make code injection. I processed like this for getting hidden passwords in edit fields.
Kenavo (Bye)
----------------------
Asm for Fun
My Links
"La garde meurt mais ne rend pas"
Cambronne à Waterloo