News:

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

Do we have WinGetClass in MASM ?

Started by hfheatherfox07, April 11, 2012, 10:52:24 PM

Previous topic - Next topic

hfheatherfox07

It seems to do as the previous example you had ...
I think I want to make it with an open file so I can open a file and display it's info

dedndave

try it on several windows
it should give the full path, usually   :P

what OS are you using ?
may have to diddle with the OpenProcess access rights flags

hfheatherfox07

Quote from: dedndave on April 12, 2012, 07:16:08 PM
try it on several windows
it should give the full path, usually   :P

what OS are you using ?
may have to diddle with the OpenProcess access rights flags

Windows XP .....
by the way I meet with this woman from Microsoft she had windows 8 on her tablet ....http://windows8beta.com/

dedndave


hfheatherfox07


dedndave



ok - i will go center a window - something i can handle   :bg

hfheatherfox07

LOL I meant I do not need to show the paths

dedndave

ohhhhhhhh
well - it's easy to strip the path off
start at the end of the string and work backwards

stop when:
1) you find a backslash
2) you find a colon
3) you get to the start of the string

hfheatherfox07

Quote from: dedndave on April 12, 2012, 05:41:59 PM
i am guessing you are only interested in top-level windows
no need to go through all the child windows

so - you'd use EnumWindows
for each hwnd, call GetWindowThreadProcessId
that will get you the PID
call OpenProcess with the SYNCHRONIZE access flag
that will get you a handle to the process
call GetModuleFileNameEx to get the filename
use CloseHandle to close the process handle when you are done

I treid fro two days I think something is wrong becuase I keep enumerating all the windows and not the file that I want .... I wander if there is a need for enumerate proc or just "INVOKE  GetClassName,FileHandle,addr lpClassName,64"
Also I noticed that the file needs to be runing ... I tried Execute Window ...but no luck .... I tried a hook .... here are my attempts  ...
I also found some examples that might have some useful ideas in it

hfheatherfox07

Google "INVOKE  GetClassName,FileHandle,addr lpClassName,64"

For obvious reasons I don't think I can post this here ...but the first result has an example that has this in it :

call    GetForegroundWindow; get handle for currently used window ( specific to NT and after )
    cmp    [hCurrentWindow], eax; if its not different to last one saved..
    je    no_window_change    ; bypass all the headings

    mov    [hCurrentWindow], eax; save it for use now and compare later

        push     64        ; get the class name
        lea     esi, [lpClassName]
        push     esi
        push     [hCurrentWindow]
        call     GetClassName


would this work?

qWord

This thread is a bit confusing: what are you exactly trying to work out?
Why you can't simply use FindWindowEx()?
FPU in a trice: SmplMath
It's that simple!

hfheatherfox07

If you look at my attachment 2nd post up ...I am trying to make a tool that gets a "windows class name" and "window name"

qWord

Quote from: hfheatherfox07 on April 16, 2012, 11:15:35 PM
I am trying to make a tool that gets a "windows class name" and "window name"
ok - so you have the window handle thus you can use GetClassName() and GetWindowText() - where is the problem?
FPU in a trice: SmplMath
It's that simple!

hfheatherfox07

Quote from: qWord on April 16, 2012, 11:23:47 PM
Quote from: hfheatherfox07 on April 16, 2012, 11:15:35 PM
I am trying to make a tool that gets a "windows class name" and "window name"
ok - so you have the window handle thus you can use GetClassName() and GetWindowText() - where is the problem?

For you .....
I am not that good yet ... I thought I got the window handle  but no luck I don't know if that app needs to run or at list how to create an open process , or should I use enumerate proc or not ....

I was up till 5AM and the better oart of today with this




qWord

From what window do you want to get the information?
Reading your post, it is not clear what you are exactly trying to do - that's make it difficult to help.
FPU in a trice: SmplMath
It's that simple!