Solved

How do I Detect Parents WindowState.

Posted on 1997-11-21
4
443 Views
Last Modified: 2012-06-21
How Can A Usercontrol Detect Changes In The Windowstate Of Its Parent?

From Tim Brockway.   Email : BROCKWAYJT@AOL.COM
Version= VB5

PROBLEM DESCRIPTION.

How can a UserControl detect changes in the WindowState of its parent / containing form??

Yes I know I could call the usercontrol from the Forms resize event passing the new parent WindowState. But I'm looking for a way of intercepting the changes without having the user controls parent do any coding.

In essence I want to pick up the parents window change event from within the "child" usercontrol. Solution must be VB based.

Any ideas ? Any thoughts would be most welcome.

Many thanks,
Tim
0
Comment
Question by:brockway
  • 3
4 Comments
 
LVL 8

Expert Comment

by:mrmick
ID: 1441884
Reference it like this:

Extender.Parent.WindowState
0
 

Author Comment

by:brockway
ID: 1441885
Sorry I should have made the question clearer.

 When I said "INTERCEPTING" I meant just that, not detecting later. In other words I want the usercontrol to be alerted or detect the Parent form windowstate change AS IT HAPPENS not next time the UserControl is invoked.

Put another way I want the usercontrol to be aware contemporaniously of the Parents Resize event triggering.

This is a toughy but if we could solve it , it would have a lot of applications.

Many thanks for the thoughts. Keep up the good work.

Tim.
0
 
LVL 8

Expert Comment

by:mrmick
ID: 1441886
hmmm...
0
 
LVL 8

Accepted Solution

by:
mrmick earned 200 total points
ID: 1441887
Try Extensibility Object.  Check it out by clicking project, then click references, then click Microsoft Visual Basic 5.0 Extensibility.

I don't know for sure, but I think this method may only work in the IDE.  So, if you only need the form information when developers are placing or developing against your control, this will do it.  If you need access to the form stuff outside of the IDE, I'm not sure if the Extensibility object model can be used in this way.  Check it out yourself in the Visual Basic Component Tools Guide Page. 661 "Extending the Visual Basic Environment with Add-Ins".  IF you decide to try it, try the short example on page 667.  It points out a few peculiarities you’ll need to know.

Other then that, you'll have to call a method in your UserControls parent form resize event.

0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Controlling which port to download from 4 71
Use Multiple Forms 4 48
VBA filters 2 50
Help me. 3 43
Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
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…
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…

914 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

20 Experts available now in Live!

Get 1:1 Help Now