Solved

Subclassing - access control properties from its hWnd

Posted on 1997-05-02
2
242 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
ID: 1425923
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
ID: 1425924
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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

831 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