473,395 Members | 1,905 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Window caption from hmodule.

Hi,

How do i find the window caption by using the hmodule of that window?

Regards
Abhishek
Dec 21 '06 #1
9 1970
"Abhishek" <sh***@activelement.comwrote in message
news:uC**************@TK2MSFTNGP04.phx.gbl...
How do i find the window caption by using the hmodule of that window?
You don't because there may be multiple such windows.

Regards,
Will
Dec 21 '06 #2
Hi William
Thanks a lot for replying.

you dont or you cant? sorry noob here. there will always be only one
instance of this window running.

regards
Abhishek
"William DePalo [MVP VC++]" <wi***********@mvps.orgwrote in message
news:%2***************@TK2MSFTNGP04.phx.gbl...
"Abhishek" <sh***@activelement.comwrote in message
news:uC**************@TK2MSFTNGP04.phx.gbl...
>How do i find the window caption by using the hmodule of that window?

You don't because there may be multiple such windows.

Regards,
Will

Dec 21 '06 #3
"Abhishek" <sh***@activelement.comwrote in message
news:Oq**************@TK2MSFTNGP06.phx.gbl...
you dont or you cant? sorry noob here. there will always be only one
instance of this window running.
It's one of those "undecidable" propositions.

Assuming you have an module handle, you could call EnumWindows(). For each
window returned call GetWindowLong(hwnd, GWL_HINSTANCE). Compare what is
returned to the module handle you have. Take those windows where you have a
match. You may get 0, 1, or more matches.

BTW, how did you get the module handle and what else do you know of the
window in question?

Regards,
Will
Dec 22 '06 #4
Hi William
firstly thanks for replying,

I have a dll that is being called by an app, the application may change but
my dll will always be called since it is a system wide hook. I need to know
the window caption of the app that loaded my dll.

Regards
Abhi

"William DePalo [MVP VC++]" <wi***********@mvps.orgwrote in message
news:%2*****************@TK2MSFTNGP04.phx.gbl...
"Abhishek" <sh***@activelement.comwrote in message
news:Oq**************@TK2MSFTNGP06.phx.gbl...
>you dont or you cant? sorry noob here. there will always be only one
instance of this window running.

It's one of those "undecidable" propositions.

Assuming you have an module handle, you could call EnumWindows(). For each
window returned call GetWindowLong(hwnd, GWL_HINSTANCE). Compare what is
returned to the module handle you have. Take those windows where you have
a match. You may get 0, 1, or more matches.

BTW, how did you get the module handle and what else do you know of the
window in question?

Regards,
Will

Dec 22 '06 #5
"Abhishek" <sh***@activelement.comwrote in message
news:e5**************@TK2MSFTNGP03.phx.gbl...
firstly thanks for replying,
You are welcome.
I have a dll that is being called by an app,
A dll is a library that contains functions which may be called (or called
back)
the application may change but my dll will always be called since it is a
system wide hook.
System wide hooks are big hammers. Swing wide of the mark and innocents get
hurt. :-)
I need to know the window caption of the app that loaded my dll.
You write "_the_ window caption" but an application which triggers a hook
may have many windows. Which do you want?

Why not take a step back and describe what you want to do rather than how
you want to do it?

Regards,
Will
Dec 22 '06 #6
Hi William,

Yep the dll is a can cause a lot of problems, We are testing it a lot and
hope to resolve most of the issues.
When EnumWindows is used the results are not that accurate and if there are
child windows associated with the application i may get the hwnd of the
child window. if my dll was launched by an exe with the caption "Testing for
HWND". i get the hmodule of this using GetModuleHandle(NULL). if i can get
the caption of this. I will get the hwnd of the parent window using
findwindow and using the caption.

BTW one of the childwindows attached to this application, is attached by my
dll itself..

Regards
Abhishek

"William DePalo [MVP VC++]" <wi***********@mvps.orgwrote in message
news:u5**************@TK2MSFTNGP03.phx.gbl...
"Abhishek" <sh***@activelement.comwrote in message
news:e5**************@TK2MSFTNGP03.phx.gbl...
>firstly thanks for replying,

You are welcome.
>I have a dll that is being called by an app,

A dll is a library that contains functions which may be called (or called
back)
>the application may change but my dll will always be called since it is a
system wide hook.

System wide hooks are big hammers. Swing wide of the mark and innocents
get hurt. :-)
>I need to know the window caption of the app that loaded my dll.

You write "_the_ window caption" but an application which triggers a hook
may have many windows. Which do you want?

Why not take a step back and describe what you want to do rather than how
you want to do it?

Regards,
Will

Dec 22 '06 #7
"Abhishek" <sh***@activelement.comwrote in message
news:OI**************@TK2MSFTNGP06.phx.gbl...
Yep the dll is a can cause a lot of problems, We are testing it a lot and
hope to resolve most of the issues.
Most?
When EnumWindows is used the results are not that accurate
How is it not accurate?
and if there are child windows associated with the application i may get
the hwnd of the child window.
No, it enumerate top-level windows.
if my dll was launched by an exe with the caption "Testing for HWND". i
get the hmodule of this using GetModuleHandle(NULL).
OK.
if i can get the caption of this. I will get the hwnd of the parent window
using findwindow and using the caption.
I explained how to do that in an earlier post. There are other ways to go as
well. The truth is that I am reluctant to explain how to do things which I
fear are too intrusive inside a system-wide hook.

Regards,
Will
Dec 22 '06 #8
Hi William

Sorry i got confused to with this. "You write "_the_ window caption" but an
application which triggers a hook.
may have many windows. Which do you want?" This has only one window and
usually one child. the child is an instance of Mozilla that is attached to
this process. I need the title of the parent window. also there will not be
multiple instances of the same parent window.

Regards
Abhishek.
Dec 22 '06 #9
It will also do if i get the HWND of the top window.
"William DePalo [MVP VC++]" <wi***********@mvps.orgwrote in message
news:uD**************@TK2MSFTNGP02.phx.gbl...
"Abhishek" <sh***@activelement.comwrote in message
news:OI**************@TK2MSFTNGP06.phx.gbl...
>Yep the dll is a can cause a lot of problems, We are testing it a lot and
hope to resolve most of the issues.

Most?
>When EnumWindows is used the results are not that accurate

How is it not accurate?
>and if there are child windows associated with the application i may get
the hwnd of the child window.

No, it enumerate top-level windows.
>if my dll was launched by an exe with the caption "Testing for HWND". i
get the hmodule of this using GetModuleHandle(NULL).

OK.
>if i can get the caption of this. I will get the hwnd of the parent
window using findwindow and using the caption.

I explained how to do that in an earlier post. There are other ways to go
as well. The truth is that I am reluctant to explain how to do things
which I fear are too intrusive inside a system-wide hook.

Regards,
Will

Dec 22 '06 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: JeffP | last post by:
I want to add a short-cut to a windows app similar to launching from a windows run line a New window, to prevent changing an existing browser window from moving off a current logged in session...
2
by: deko | last post by:
I have two subforms within a particular form. The one on top is a datasheet of transactions; the one on the bottom is a summary of totals. I would like to have the datasheet fill the entire...
3
by: Brian Henry | last post by:
does anyone know the user32.dll function or how i can do this? I want to set the caption of a window based on the handel i specify... i already have the functions to get the handel of the window...
0
by: Chenghui Li | last post by:
We have a problem with the Windows XP theme: We have a IDE which allows other developers to develop visual programs for their customers. Our IDE allow them to set font for window captions easyly...
0
by: Bonj | last post by:
I'm having severe issues with my DLL which is using CreateWindow to display a user-input window. I don't want to use DialogBox and a dialog resource because it might be called from a console...
2
by: Trammel | last post by:
Hi. I have been trying to make a simple application that will sit in the background and alert me of any changes in window focus (IE: Pop-up windows) on my system. I have used...
0
by: Steve Barnett | last post by:
I've created a simple MDI application and have designated the Window menu to keep track of the mdi children. When I first load an mdi child, it's caption consists of "File: no file loaded" and this...
0
by: kloplop321 | last post by:
I found this code(vb only) and it does about the same thing(in vb, not vb .NET 2005) Attribute VB_Name = "Form1" Attribute VB_GlobalNameSpace = False Attribute VB_Creatable = False Attribute...
1
by: wormsnout | last post by:
Hi all, I'm looking to write some Visual Basic .NET code to find a Window given its Caption and then kill it entirely (not just minimise it). I think I have found the correct Windows Handle...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.