News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests

Main Menu

New tool/toy for getting a window's class name

Started by hutch--, September 09, 2014, 10:39:16 PM

Previous topic - Next topic

hutch--

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.

TouEnMasm

Fa is a musical note to play with CL

Gunther

You have to know the facts before you can distort them.

Siekmanski

Creative coders use backward thinking techniques as a strategy.

MichaelW

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

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--

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.

Grincheux

Kenavo (Bye)
----------------------
Help me if you can, I'm feeling down...

Grincheux


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)
----------------------
Help me if you can, I'm feeling down...

hutch--

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.

Grincheux

Just make code injection. I processed like this for getting hidden passwords in edit fields.
Kenavo (Bye)
----------------------
Help me if you can, I'm feeling down...