Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4015208
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T09:35:27+00:00 2026-05-20T09:35:27+00:00

I have been able to successfully wrap my unmanaged Borland C++ dll, and launch

  • 0

I have been able to successfully wrap my unmanaged Borland C++ dll, and launch it’s forms from a C# .NET 4.0 application. Is it possible to embed a form from the dll directly into a .NET application?

To clarify, the original form is being used as an embedded control in a Borland C++ project already. It essentially looks like a custom control, sitting on a panel within the application.

When I say ’embed’ I mean place INTO a form in the same way you drop buttons, panels, etc on to a form. I’m not looking to just make a child form.

If this is not possible, then perhaps a better question would be how do I embed an unmanged custom control into a .Net application?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T09:35:28+00:00Added an answer on May 20, 2026 at 9:35 am

    Yes, you just need to use some low-level win32 functions from user32.dll : SetParent, GetWindowLog, SetWindowLong , MoveWindow . You can create an empty .NET container control, set the parent of the native window to the .NET control, then (optionally) modify the window style (i.e. to remove borders of native window), and pay attention to resize it together with the .NET control. Note that, at a managed level, the .NET control will be unaware it has any children.

    In the .NET control do something like

    public void AddNativeChildWindow(IntPtr hWndChild){
    
            //adjust window style of child in case it is a top-level window
            int iStyle = GetWindowLong(hWndChild, GWL_STYLE);
            iStyle = iStyle & (int)(~(WS_OVERLAPPEDWINDOW | WS_POPUP));
            iStyle = iStyle | WS_CHILD;
            SetWindowLong(hWndChild, GWL_STYLE, iStyle);
    
    
            //let the .NET control  be the parent of the native window
            SetParent((IntPtr)hWndChild, this.Handle);
             this._childHandle=hWndChild;
    
            // just for fun, send an appropriate message to the .NET control 
            SendMessage(this.Handle, WM_PARENTNOTIFY, (IntPtr)1, (IntPtr)hWndChild);
    
    }
    

    Then override the WndProc of the .NET control to make it resize the native form appropriately — for example to fill the client area.

     protected override unsafe void WndProc(ref Message m)
        {
    
            switch (m.Msg)
            {
                case WM_PARENTNOTIFY:
                       //... maybe change the border styles , etc
                       break;
                  case WM_SIZE:
                    iWid =(int)( (int)m.LParam & 0xFFFF);
                    iHei= (int) (m.LParam) >> 16;
                    if (_childHandle != (IntPtr)0)
                    {
    
                        MoveWindow(_childHandle, 0, 0, iWid, iHei, true);
    
                    }
                    break;
    
            }
    
     }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been able to copy the raw data from an otherwise inaccessible USB
The project is ASP.NET 2.0, I have never been able to reproduce this myself,
I have been able to zip the contents of my folder. But I would
I have been able to create ASPX pages without the code behind, but I
The best that I have been able to come up with is: strlen(preg_replace('/^([\\*]*)\s(.+)/',$1,$line)); ^^That
It seems obvious that some people have been able to figure out how to
I have not been able to find a way to cancel/terminate asynchronous read operation
I am trying to use the following code, which I have not been able
I have gone through their developer guide but haven't been able to find a
I need customers to be able to download PDFs of letters that have been

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.