Click to See Complete Forum and Search --> : [RESOLVED] Why is ActiveForm not set?


James_dean
February 2nd, 2007, 12:43 AM
I have the following

Form1^ myFrm = gcnew Form1();
myFrm->ShowDialog();

HWND handle = (HWND)myFrm->Handle.ToPointer();

The handle is null for some reason even though the form is active. Also the result of "myFrm->Active" is true?. How can that be true when the handle is null.....

please somebody explain why my activeform is not set and if possible how to set the Form::ActiveForm property.

petes1234
February 2nd, 2007, 07:30 AM
why the ".ToPointer()" method?
what does this do?: IntPtr handle = myFrm->Handle; ?

James_dean
February 3rd, 2007, 11:42 AM
Well i am using .ToInt32() method instead of .ToPointer() because HWND is an int32 and this is required for the conversion

James_dean
February 3rd, 2007, 11:46 AM
Well i am using .ToInt32() method instead of .ToPointer() because HWND is an int32 and this is required for the conversion
what does this do?: IntPtr handle = myFrm->Handle; ?
sorry should be HWND handle = myFrm->Handle.ToInt32();
returning the handle from the current window as i need this handle to pass into a native function.........that should make things a little clearer....sorry