Solved

Sublassing a window question

Posted on 1998-12-30
2
186 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
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 100 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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Suggested Solutions

Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
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.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

743 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now