title: Loading a Win32 control in C# (specifically WPF)
body: <p>I have written a set of Win32 dlls that encapsulate a Delphi Frame (see Snippet 1 below), and can load them into another Delphi program by loading the dll and assigning the right variables (Snippet 2). I now want to be able to do the same thing in C# (I can load the DLL in pinvoke, but am unsure how to connect up the control to the basic WPF 'form'. </p>
  
  <p>Snippet 1</p>
  
  <pre><code>var
    frame : TFrame1;
  
  function CreateFrame(hParent:TWinControl):Integer; stdcall; export;    
  begin    
    try
      frame := TFrame1.Create(hParent);
      frame.Parent := hParent;
  
      frame.Align := alClient;
    finally
      result := 1;
    end;
  
  end;
  
  exports CreateFrame name 'CreateFrame';
  </code></pre>
  
  <p>Snippet 2</p>
  
  <pre><code>  DLLHandle := LoadLibrary('Library/Demo.Frame.dll');
    If DLLHandle &gt; 32 then
    begin
      ReturnValue := GetProcAddress(DLLHandle, 'CreateFrame');
    end;
  
    ts1 := TTabSheet.Create(PageControl1);
    with ts1 do
    begin
      PageControl := PageControl1;
  
      Name := 'tsExternal';
      Caption := 'External';
      Align := alClient;
  
      ReturnValue (ts1);
    end;
  </code></pre>
  
  <p>Any help would be greatly appreciated.</p>