News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

FindWindow alternative?

Started by Crashish, March 30, 2006, 08:32:27 PM

Previous topic - Next topic

Crashish

Is there an alternative to FindWindow in order to obtain a window handle?
For instance, how would you get the window handle of a process who's window caption and class name always change, since FindWindow
only looks for an exact match.

IRC for example displays the time as part of it's window caption, therefore you couldn't use the window caption to get a valid window handle. Let's assume for this example that the class changes aswell.
I've wore google out looking. However, I've found the names of some functions that do just this but don't understand how to translate that to
asm. FindWindowLike is one that I came across, it's a function written for Visual Basic I believe. What would be the simplest of accomplishing this?

Thanks

MichaelW

eschew obfuscation

P1

Crash,

Welcome a Board !!!      :U

Forum 'Search' is your friend, along with Google.    :dance:

Please read the forum rules.

This is what I use for general purpose Window work:
invoke EnumWindows,offset EnumWindowsProc,0

Regards,  P1  :8)

Crashish

Hello and thanks for the quick response.

QuoteThe class name is changing?

Some applications I've came across have both a dynamic caption and class. Programs that have 'afx' window class shows they use a dynamic class.
For example, Class: Afx 260000:4:131e:0:52ac. Some applications append the 'pid' to the end of the caption and the class, thus FindWindow
will not work. Netscape, Adobe Acrobat and number of games have dynamic window classes for example.

hutch--

P1's suggestion is probably the one that will do the job for you but its more complicated than a FindWindow() function call. Dynamic class names and variable captions make FindWindow of little use for what you want to do and much of this is by design for security reasons at the OS and development level with many apps.

With the "enumeration" approach it will allow you to scan varous characteristics of each running app so you can try and identify what is running and get its handle.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

asmfan

also you can use GetWindowLong to scan some constant characteristics WndProc for example.
Russia is a weird place