Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Sublassing a window question

Posted on 1998-12-30
2
Medium Priority
?
195 Views
Last Modified: 2013-11-20
Hello EveryBody !
When I try to subclass a normal window ( Dialog that is existent on my desktop ) I fail at the stage of check whether the HWND is already attached to a permanent CWND* .
Is there any way to make such a subclass ?
I want to get messages that go to the specific window that was opened by another application . I dont want to use System Hooks method .
Any ideas ?

Thank you in advance ,
Oleg
0
Comment
Question by:Maizlish
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 

Expert Comment

by:koskia
ID: 1326993
As far as I know you're trying something that you can't do
subclassing a window is only within your application
if it wasn't so, you could get into other applications (Photoshop, Netscape, IE, etc. ...)
anything really, and control them through your app.
the given answer is that a window can only be subclassed once.
0
 
LVL 15

Accepted Solution

by:
Tommy Hui earned 200 total points
ID: 1326994
Sorry, but under Win32 you will need to break the process boundaries between applications somehow. One way is to use a system hook. Since you indicated you didn't want to use this method, there are others.

1. Inject a DLL into all applications by using the registry
  HKLM\Software\Microsoft\Windows NT\CurrentVersion\Windows\AppInit_DLLs
Note that this only works for NT systems.

2. Use CreateRemoteThread(). This again is only on NT systems as Win9x does not support this method.

3. If you are interested in a particular process, you can use the debugging APIs and force it to do a LoadLibrary() of your DLL at the start. This is completely portable, but only affects programs you start explicitly.

4. Use SetWindowsHookEx(). This is portable and affects all applications.

PS. It is possible to subclass a window multiple times. What you are running into is that MFC does not allow you subclass windows you did not create, which is why it is necessary to break through process boundaries.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
In this post we will learn different types of Android Layout and some basics of an Android App.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Suggested Courses

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question