ashishraj14
Programmer
I have a VB6 application which I want to use in .NET application. I have created a public class in VB6 app which has following public method on it and compiled my VB6 app as ActiveX.exe
Public Function GetFormFrameHwnd() As Long
Dim frm As New frmCompany
GetFormFrameHwnd = frm.Frame2.hWnd
End Function
The above method returns window handle for frmCompany.Frame2 which is displayed in .NET Widnows Form using SetParent API call as follows
private void Form1_Load(object sender, EventArgs e)
{
Project1.Class1Class obj = new Project1.Class1Class();
SetParent(new IntPtr(obj.GetFrameHandle()), this.Handle);
}
I am facing two problems here. When .NET application is closed the VB6 keeps running in the back ground and doesn’t get destroyed (i can see it in Task List). Secondly controls doesn’t get populated with data and neither of the buttons work.
Could please suggest what I am doing wrong. Is there any other better way of calling VB6 forms from .NET app.
Thanks
Public Function GetFormFrameHwnd() As Long
Dim frm As New frmCompany
GetFormFrameHwnd = frm.Frame2.hWnd
End Function
The above method returns window handle for frmCompany.Frame2 which is displayed in .NET Widnows Form using SetParent API call as follows
private void Form1_Load(object sender, EventArgs e)
{
Project1.Class1Class obj = new Project1.Class1Class();
SetParent(new IntPtr(obj.GetFrameHandle()), this.Handle);
}
I am facing two problems here. When .NET application is closed the VB6 keeps running in the back ground and doesn’t get destroyed (i can see it in Task List). Secondly controls doesn’t get populated with data and neither of the buttons work.
Could please suggest what I am doing wrong. Is there any other better way of calling VB6 forms from .NET app.
Thanks