How to set the Form of a C# assembly as a child to COM Compatible Forms?
-
Hi all, I'm new to .NET environment. I wrote an assembly in C#. This will take the Handle of the form from the client application and sets the form of this assembly as child to the Client application form. When i send the parent handle from the .NET client the form in the assembly appears as child form. But when i send the parent handle from the COM comaptible language(VB6 or VC++) forms,it doesn't appear as child instead it appears outside of the form. My code is <u>In MyAssembly.dll</u> public bool Create(long hwndParent) { ChildForm f = new ChildForm(); // object for the Form present in the Assembly f.TopLevel = false; f.Parent = Form.FromHandle((IntPtr)hwndParent); f.Show(); return true; } <u>From VC++ Client</u> { IFramePtr pChildFrame; //Object for the Assembly HRESULT hr = pChildFrame.CreateInstance(__uuidof(CFrame)); if(FAILED(hr)) { AfxMessageBox(_T("Failed")); } pChildFrame->Create((long)this->m_hWnd); } Can any one please help me Thanks in advance
-
Hi all, I'm new to .NET environment. I wrote an assembly in C#. This will take the Handle of the form from the client application and sets the form of this assembly as child to the Client application form. When i send the parent handle from the .NET client the form in the assembly appears as child form. But when i send the parent handle from the COM comaptible language(VB6 or VC++) forms,it doesn't appear as child instead it appears outside of the form. My code is <u>In MyAssembly.dll</u> public bool Create(long hwndParent) { ChildForm f = new ChildForm(); // object for the Form present in the Assembly f.TopLevel = false; f.Parent = Form.FromHandle((IntPtr)hwndParent); f.Show(); return true; } <u>From VC++ Client</u> { IFramePtr pChildFrame; //Object for the Assembly HRESULT hr = pChildFrame.CreateInstance(__uuidof(CFrame)); if(FAILED(hr)) { AfxMessageBox(_T("Failed")); } pChildFrame->Create((long)this->m_hWnd); } Can any one please help me Thanks in advance
Did you get this to work yet?
"I guess it's what separates the professionals from the drag and drop, girly wirly, namby pamby, wishy washy, can't code for crap types." - Pete O'Hanlon