Solved

Subclassing - access control properties from its hWnd

Posted on 1997-05-02
2
234 Views
Last Modified: 2011-10-03
I am current attempting to use VB5 to subclass the MaskEdBox control.  This involves coding a C-Style WndProc that has the arguments: hWnd, uMsg, wParam, lParam and redirecting the messages sent to the control to the WndProc.  Here's my question:  Using the hWnd passed to the proc, how can I access the Mask property of the MaskEdBox control?
0
Comment
Question by:Rosedust
2 Comments
 
LVL 3

Accepted Solution

by:
dansari earned 100 total points
Comment Utility
I believe you cannot access properties of an OLE control just by knowing its hWnd - the window of an OLE control is actually quite removed from the "heart" of the control.

Your method would work fine if you're subclassing a regular Windows control.

But, if you want to subclass an OLE (ActiveX) control, you should use VB5 to create an ActiveX project, and use the MaskEdBox in here.  This way, your control acts as a "wrapper" around the MaskEdBox.  You can make a Mask property (as well as all the other properties/methods/events of MaskEdBox) in your control,
so that it will behave as much like MaskEdBox as you want.
0
 

Author Comment

by:Rosedust
Comment Utility
The ActiveX / OLE solution is unacceptable because it is extremely slow when compared to the subclassing method.  If a single form has a large number of these controls, the user is forced to sit and wait while the controls load.
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

763 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

12 Experts available now in Live!

Get 1:1 Help Now