News:

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

Main Menu

Problem gettting child window caption

Started by x64Core, October 01, 2013, 05:56:34 PM

Previous topic - Next topic

x64Core

hello guys im not able to get the caption of a child window, check spy does:

I wan to get:
masm32.com/board/index.php
my code:


.586
.model flat,stdcall
include masm32rt.inc
.data
class1 db "Chrome_WidgetWin_1",0
subw db "Chrome_OmniboxView",0
.code
Start proc

    invoke FindWindow,addr class1,0
    invoke FindWindowEx,eax,0,addr subw,0
    ; eax = zero
Ret
Start EndP
End Start

EAX equal to zero, im not able to figure out the problem, any help please


TWell

#1
Both windows are in same level.
"Chrome_OmniboxView" isn't child of "Chrome_WidgetWin_1" ?
EDIT:
Test with IronPortable:
"Chrome_OmniboxView" is child of "Chrome_WidgetWin_1"
SendMessage with WM_GETTEXT works.

x64Core

Quote from: TWell on October 01, 2013, 06:29:53 PM
Both windows are in same level.
"Chrome_OmniboxView" isn't child of "Chrome_WidgetWin_1" ?
nope, calling FindWindow plus Chrome_OmniboxView string doesnt work.

Added:
also, I tried by calling EnumWindow or EnumChildWindow and no function was able to get the string...

sinsi

Try FindWindow with lpClassName=null and lpWindowName=masm32.com/board/index.php

dedndave

lpClassName=NULL
lpWindowName=>"masm32.com/board/index.php"

x64Core

The problem is, I cannot get handle from title,  because it will change constantly
Class is ok as it will not change never in the program.

program is google chrome. its very strange, I tried a lot of things  :icon_eek:

TWell

#6
EDIT: The class "Chrome_OmniboxView" was removed in newer versions.

x64Core

TWell , your code shows me nothing, it does not find Chrome_OmniboxView class. is it working for you?
My google version is: Version 28.0.1500.95 m

dedndave

if it is a child window, you want to use FindWindowEx
FindWindow is for top-level windows
to use FindWindowEx, you need the handle of the parent window

so...
    .DATA
szParentClass db '????',0
szChildClass  db '????',0

    .CODE
    INVOKE  FindWindow,offset szParentClass,NULL
    .if eax
        INVOKE  FindWindowEx,eax,NULL,offset szChildClass,NULL
    .endif


now - you may have multiple instances of chrome
i will let you deal with that one, as i don't have it installed   :P

x64Core

#9
Quote from: TWell on October 02, 2013, 03:51:23 AMEDIT: The class "Chrome_OmniboxView" was removed in newer versions.
If so how does spy do to get string, i dont think so  :icon_eek:

@dedndave:
Check my post #1 I did so, but for some reason findWindowEx doesnt work but spy is able to get string.

I dont understand how the # spy is able to get string

I tried with several programs:


WinInspector is able to do it as well.

Edit # = Profanity




dedndave

ok - there are a few complications that you may be running into

first - the window may be a UNICODE window - with a UNICODE class name
you should be able to look at the window properties under spy++ to see
i haven't had much experience here, but it's a possibility

secondly, under windows 7, some child windows/controls are isolated by a worker window
these windows seem to be all over the place if you use the aero glass theme
sometimes, these windows have "shell" and/or "dll" in the names
but - i think spy++ will spot those windows

otherwise - check the windows properties carefully for style bits - etc
anything unusual that might make them hard to find
i could be more help if i were using the same OS and chrome
but - i use XP and firefox   :P

if all else fails, you should be able to get the parent handle and enumerate all child windows to find it

dedndave

question - are you able to get the parent handle with FindWindow ???
display it in a MessageBox to verify it is non-zero

x64Core

Quote from: dedndave on October 02, 2013, 07:16:58 AM
question - are you able to get the parent handle with FindWindow ???
display it in a MessageBox to verify it is non-zero
It is assumed that the parent is Chrome_WidgetWin_1 class, FindWindow finds it but FindWindowEx doesnt find the child (Chrome_OmniboxView). I will debug Spy++ to know how it works.


dedndave

i would think spy++ uses EnumChildWindows

x64Core

Quote from: dedndave on October 02, 2013, 07:35:55 AM
i would think spy++ uses EnumChildWindows
Yeah I think so, but it doesn work.
I tried EnumWindows plus EnumChildWindow as I said inabove posts :P