Solved

Sublassing a window question

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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
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.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

828 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