Hi James,
Thanks for posting in the community.
First of all, I would like to confirm my understanding of your issue.
From your description, I understand that you are using P/Invoke to consume
an third-party product in VB.NET which works in VB6, and the process will
not terminate after you close the winform application.
Have I fully understood you? If there is anything I misunderstood, please
feel free to let me know.
' Max startup and shutdown functions
Declare Function InitMAXOrder Lib "MAXORDR2.DLL" (ByRef DataPath As
StringBuilder, ByRef MAXPath As StringBuilder) As Integer
Declare Function ShutdownMAXOrder Lib "MAXORDR2.DLL" (ByVal ObjectHandle
As Integer) As Short
When you close the winform application, you observe the still running
process, what is its CPU consuming, zero or high CPU utilization. Also it
seems that you when you call the ShutdownMAXOrder, you will pass a handle
to the function, I guess it should be an ObjectHandle which is need to be
terminated by the ShutdownMAXOrder inside the DLL, so you may need to
check if the value is the same as the value you get the handle, and check
the Marshal.GetLastWin32Error to check if there is any error.
Marshal.GetLastWin32Error Method
http://msdn.microsoft.com/library/de...us/cpref/html/
frlrfSystemRuntimeInteropServicesMarshalClassGetLa stWin32ErrorTopic.asp
Also you may try to simplify the sample which works in VB6.( e.g. just call
the InitMAXOrder and ShutdownMAXOrder) and use the Visual Basic .NET
Upgrate Wizard to upgrate the vb6 project vb.net to see if the problem
persists.
Please apply my suggestion above and let me know if it helps resolve your
problem.
Best regards,
Peter Huang
Microsoft Online Partner Support
Get Secure! -
www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.