Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Subclassing - access control properties from its hWnd

Posted on 1997-05-02
2
246 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

860 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