Solved

Sublassing a window question

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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Windows Drag & Drop Location 2 100
How to create frequencies of a variable from SAS dataset? 10 125
substring method in java 1 116
Problem to open Excel file 15 128
In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
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.
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.

813 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

10 Experts available now in Live!

Get 1:1 Help Now