Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. How to set the Form of a C# assembly as a child to COM Compatible Forms?

How to set the Form of a C# assembly as a child to COM Compatible Forms?

Scheduled Pinned Locked Moved C#
csharpc++comhelp
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    ss431
    wrote on last edited by
    #1

    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

    P 1 Reply Last reply
    0
    • S ss431

      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

      P Offline
      P Offline
      Paul Conrad
      wrote on last edited by
      #2

      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

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups