If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

getting the name of the application that contains my control

I created a control for saving the size and position of a form in the registry.
You drop the control on the form and it does the rest - when the user resizes
the form the control makes a new entry in the registry so and when the application
starts again the control gets that info from the registry and resizes the
form to the size it had when the appliction was last running. There is just
one problem with it. I used the form name for the name of the registery key
to store this information. This works great in most situations but if I use
the control in two different applications which have forms that have the
same name then I run into a problem. For example if project1 has a form called
form1 and project2 has a form called form1
my control saves the form height in HKEY_CURRENT_USER\software\VB and VBA
program settings\formsaver\formsaver\form1\form1.height for both projects.
What I need is a way for the control to get the name of the application that
contains the form in which it is contained. If I use app.exename I get the
name of my control - not the name of the application which is using my control.
I can get the name of the form that contains my form with usercontrol.parent.name
but my question is how can my user control get the name of the application
which is using it. Thanks for your patientence reading this and thanks to
Steve (kinell_98@yahoo.com) who did a great job of explaining how to make
my control aware of the container form's events.

Re: getting the name of the application that contains my control

"Floyd McDonald" <floydmcdonald@hotmail.com> wrote:
>
>I created a control for saving the size and position of a form in the registry.
>You drop the control on the form and it does the rest - when the user resizes
>the form the control makes a new entry in the registry so and when the application
>starts again the control gets that info from the registry and resizes the
>form to the size it had when the appliction was last running. There is just
>one problem with it. I used the form name for the name of the registery
key
>to store this information. This works great in most situations but if I
use
>the control in two different applications which have forms that have the
>same name then I run into a problem. For example if project1 has a form
called
>form1 and project2 has a form called form1
>my control saves the form height in HKEY_CURRENT_USER\software\VB and VBA
>program settings\formsaver\formsaver\form1\form1.height for both projects.
>What I need is a way for the control to get the name of the application
that
>contains the form in which it is contained. If I use app.exename I get the
>name of my control - not the name of the application which is using my control.
>I can get the name of the form that contains my form with usercontrol.parent.name
>but my question is how can my user control get the name of the application
>which is using it. Thanks for your patientence reading this and thanks to
>Steve (kinell_98@yahoo.com) who did a great job of explaining how to make
>my control aware of the container form's events.
>
>

i got a little ocx that implements what you needs, i will send it to your
mail because is long to explain here, good luck. :-)