Click to See Complete Forum and Search --> : Accessing the Main Window of an application


RachelB
November 23rd, 2006, 07:13 AM
In MFC there is an AfxGetMainWnd function which returns a pointer to the active main window. Is there something similar in C#?

If not, does anyone know how to do it?

Thanks in advance

R

pareshgh
November 23rd, 2006, 11:02 PM
why can't u create a singleton instance which holds
a ref. to your main window. this will be created at
the formload / ctor event of your main form.

shouldn't be that hard.


Paresh

RachelB
November 24th, 2006, 05:14 AM
Cheers Paresh, I'll give it a go.