Forms in Class Libaries

  • Thread starter Thread starter Wayne
  • Start date Start date
W

Wayne

I have a class lib, that creates and shows a form. When the main app is
minimized the form from the class lib isn't. Also when pressing Alt+Tab the
class lib form shows in the window selection.

How do I make it minimize when the application is minimized and not show in
the alt+tab window?

Thanks
Wayne
 
Hi Wayne,

First set the lib form ShowInTaskbar property to false.
Second befre showng the lib form set its Owner (not Parent) property to
reference the application main form
 
Ok, how do I do this?

Guess what I need to know is from the Form in the class lib, how do I get
the applications main form? Not sure if this matters, but the class libs are
dynamiclly loaded at run time. They are not referanced in the main
application. These are for my in the works plugin system.

Thanks
Wayne


Stoitcho Goutsev (100) said:
Hi Wayne,

First set the lib form ShowInTaskbar property to false.
Second befre showng the lib form set its Owner (not Parent) property to
reference the application main form

--
HTH
Stoitcho Goutsev (100) [C# MVP]


Wayne said:
I have a class lib, that creates and shows a form. When the main app is
minimized the form from the class lib isn't. Also when pressing Alt+Tab the
class lib form shows in the window selection.

How do I make it minimize when the application is minimized and not show in
the alt+tab window?

Thanks
Wayne
 
Hi, Wayne

How class libs are loaded if they are not referenced?

When you create classes from class libs, you can pass parent form reference,
for example in constructor parameters. Or through any interface methods you
defined - if any.

HTH
Alex

Wayne said:
Ok, how do I do this?

Guess what I need to know is from the Form in the class lib, how do I get
the applications main form? Not sure if this matters, but the class libs are
dynamiclly loaded at run time. They are not referanced in the main
application. These are for my in the works plugin system.

Thanks
Wayne


Stoitcho Goutsev (100) said:
Hi Wayne,

First set the lib form ShowInTaskbar property to false.
Second befre showng the lib form set its Owner (not Parent) property to
reference the application main form

--
HTH
Stoitcho Goutsev (100) [C# MVP]


Wayne said:
I have a class lib, that creates and shows a form. When the main app is
minimized the form from the class lib isn't. Also when pressing
Alt+Tab
the
class lib form shows in the window selection.

How do I make it minimize when the application is minimized and not
show
in
the alt+tab window?

Thanks
Wayne
 
Wayne,

Frankly I don't know haw to get the main form. Normaly the main form has to
do this, I believe. Anyways try to use Process.MainWindowHandle and then
Control.FormHandle or Control.FromChildHandle. However I don't know how it
works in the cases where the process host more than one AppDomains or the
process has more than one top level windows. What internaly this property
does is to enumerate all top level windnows and returns the first one which
is created by a thread in the process.

--

Stoitcho Goutsev (100) [C# MVP]


Wayne said:
Ok, how do I do this?

Guess what I need to know is from the Form in the class lib, how do I get
the applications main form? Not sure if this matters, but the class libs are
dynamiclly loaded at run time. They are not referanced in the main
application. These are for my in the works plugin system.

Thanks
Wayne


Stoitcho Goutsev (100) said:
Hi Wayne,

First set the lib form ShowInTaskbar property to false.
Second befre showng the lib form set its Owner (not Parent) property to
reference the application main form

--
HTH
Stoitcho Goutsev (100) [C# MVP]


Wayne said:
I have a class lib, that creates and shows a form. When the main app is
minimized the form from the class lib isn't. Also when pressing
Alt+Tab
the
class lib form shows in the window selection.

How do I make it minimize when the application is minimized and not
show
in
the alt+tab window?

Thanks
Wayne
 
Basiclly I look for files in the source dir with a given ext. I then use
Assembly.LoadFrom(fileName) to load the assembly. From there I ittirate
through all the types contained in the assembly looking for types that
inherit from my base class. When Found I create an instance of the type and
add a menu item for that type, setting the on click of the menu to a method
of the new instance. When the user clicks the menu item it does what ever
was in the assembly to be done.

Currently there is no way in my set up to pass the main form, The app I have
has already been deployed and not sure how difficult it will be for me to
have to change the class interface that is being used with in the app.

Hope the above makes sense.
Thanks
Wayne



AlexS said:
Hi, Wayne

How class libs are loaded if they are not referenced?

When you create classes from class libs, you can pass parent form reference,
for example in constructor parameters. Or through any interface methods you
defined - if any.

HTH
Alex

Wayne said:
Ok, how do I do this?

Guess what I need to know is from the Form in the class lib, how do I get
the applications main form? Not sure if this matters, but the class libs are
dynamiclly loaded at run time. They are not referanced in the main
application. These are for my in the works plugin system.

Thanks
Wayne


Stoitcho Goutsev (100) said:
Hi Wayne,

First set the lib form ShowInTaskbar property to false.
Second befre showng the lib form set its Owner (not Parent) property to
reference the application main form

--
HTH
Stoitcho Goutsev (100) [C# MVP]


I have a class lib, that creates and shows a form. When the main app is
minimized the form from the class lib isn't. Also when pressing Alt+Tab
the
class lib form shows in the window selection.

How do I make it minimize when the application is minimized and not show
in
the alt+tab window?

Thanks
Wayne
 
Back
Top