The MASM Forum

Projects => MASM32 => Topic started by: hutch-- on September 09, 2014, 10:39:16 PM

Title: New tool/toy for getting a window's class name
Post by: hutch-- 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.
Title: Re: New tool/toy for getting a window's class name
Post by: TouEnMasm on September 10, 2014, 01:52:12 AM
It work on xp SP3
Title: Re: New tool/toy for getting a window's class name
Post by: Gunther on September 10, 2014, 02:14:27 AM
Steve,

works fine under Windows 7-64.

Gunther
Title: Re: New tool/toy for getting a window's class name
Post by: Siekmanski on September 10, 2014, 02:53:24 AM
Works under Windows 8.1 64bit
Title: Re: New tool/toy for getting a window's class name
Post by: MichaelW 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.
Title: Re: New tool/toy for getting a window's class name
Post by: Zen 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,...(http://www.conceptart.org/images/ca_smilies/advanced/anj_hatsoff.gif)
Title: Re: New tool/toy for getting a window's class name
Post by: hutch-- 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.
Title: Re: New tool/toy for getting a window's class name
Post by: Grincheux on December 07, 2015, 06:29:52 AM
Works on W10 PRO 64 bits
Title: Re: New tool/toy for getting a window's class name
Post by: Grincheux on December 07, 2015, 06:34:09 AM

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'.
Title: Re: New tool/toy for getting a window's class name
Post by: hutch-- 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.
Title: Re: New tool/toy for getting a window's class name
Post by: Grincheux on December 07, 2015, 01:32:12 PM
Just make code injection. I processed like this for getting hidden passwords in edit fields.