Re: How to get a reference to main form in a Windows Form 2.0 Application?
- From: Jon Shemitz <jon@xxxxxxxxxxxxxxxxx>
- Date: Fri, 25 Aug 2006 13:47:52 -0700
Alan Pretre wrote:
Form MainForm =
(Form)Control.FromHandle(Process.GetCurrentProcess().MainWindowHandle);
But what control would a library (dll) have access to? It is separate from
the exe.
So? It's running in the same process, and using the same
System.Windows.Forms code. In fact, this library
using System;
using System.Diagnostics;
using System.Windows.Forms;
namespace Get
{
public static class Main
{
public static Form Form
{
get { return
(Form)Control.FromHandle(Process.GetCurrentProcess().MainWindowHandle);
}
}
}
}
works just as well as code in a form event handler ....
--
..NET 2.0 for Delphi Programmers www.midnightbeach.com/.net
Delphi skills make .NET easy to learn In print, in stores.
.
- References:
- How to get a reference to main form in a Windows Form 2.0 Application?
- From: jldearmas
- Re: How to get a reference to main form in a Windows Form 2.0 Application?
- From: Jon Shemitz
- Re: How to get a reference to main form in a Windows Form 2.0 Application?
- From: Jon Shemitz
- Re: How to get a reference to main form in a Windows Form 2.0 Application?
- From: Alan Pretre
- How to get a reference to main form in a Windows Form 2.0 Application?
- Prev by Date: Re: How to get a reference to main form in a Windows Form 2.0 Application?
- Next by Date: Re: Adding scheduling to an application
- Previous by thread: Re: How to get a reference to main form in a Windows Form 2.0 Application?
- Next by thread: Re: How to get a reference to main form in a Windows Form 2.0 Application?
- Index(es):
Relevant Pages
|