472,345 Members | 1,600 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,345 software developers and data experts.

Problem with third party dll, and application shut down - help!

Hello,

I am using some external functions supplied by an ERP vendor in a
windows.forms application (vb.net, visual studio.net 2003)

The functions are defined as follows:

' 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

If I never execute the functions, everything works fine....

Once I execute the initialization and shutdown however, the application
closed fine, but the process is still running when I look in Task Manager.

If I use a process.GetCurrentProcess.kill statement, which I assume forces
everything out of memory, the process is stopped.

My question is: Is there a more gracefull way to close down whatever
resource is being held, without using the process kill command? And, if I
have to use a process kill command, is there a way to set a return code to
be returned from the application?

Thanks!

Jim
Nov 20 '05 #1
5 1748
James,

* "James Radke" <jr*****@wi.rr.com> scripsit:
I am using some external functions supplied by an ERP vendor in a
windows.forms application (vb.net, visual studio.net 2003)

The functions are defined as follows:

' 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

If I never execute the functions, everything works fine....

Once I execute the initialization and shutdown however, the application
closed fine, but the process is still running when I look in Task Manager.

If I use a process.GetCurrentProcess.kill statement, which I assume forces
everything out of memory, the process is stopped.


What does the manufacturer write about this problem? Are you sure you
are using the functions properly?

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #2
The manufacturer has the worst technical support I have ever run across.
They have not been able to answer any questions posed to them.

And, yes, I followed their sample application (written in VB6) and am using
the routines exactly the same way that they used them.

When I use a monitor to check the remaining process in memory, it looks like
it has a thread that is somehow related to the NTDLL.DLL - whatever that
is.... then if I shutdown that thread, the process stops....... Does that
help?

Jim
"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:c1*************@ID-208219.news.uni-berlin.de...
James,

* "James Radke" <jr*****@wi.rr.com> scripsit:
I am using some external functions supplied by an ERP vendor in a
windows.forms application (vb.net, visual studio.net 2003)

The functions are defined as follows:

' 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

If I never execute the functions, everything works fine....

Once I execute the initialization and shutdown however, the application
closed fine, but the process is still running when I look in Task Manager.
If I use a process.GetCurrentProcess.kill statement, which I assume forces everything out of memory, the process is stopped.


What does the manufacturer write about this problem? Are you sure you
are using the functions properly?

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>

Nov 20 '05 #3
> Hello,

I am using some external functions supplied by an ERP vendor in a
windows.forms application (vb.net, visual studio.net 2003)

The functions are defined as follows:

' Max startup and shutdown functions
Declare Function InitMAXOrder Lib "MAXORDR2.DLL" (ByRef DataPath As
StringBuilder, ByRef MAXPath As StringBuilder) As Integer
Does it really call for a StringBuilder to be passed to a regular DLL?
Isn't this a Managed type only?

Declare Function ShutdownMAXOrder Lib "MAXORDR2.DLL" (ByVal ObjectHandle As Integer) As Short

If I never execute the functions, everything works fine....

Once I execute the initialization and shutdown however, the application
closed fine, but the process is still running when I look in Task Manager.

If I use a process.GetCurrentProcess.kill statement, which I assume forces
everything out of memory, the process is stopped.

My question is: Is there a more gracefull way to close down whatever
resource is being held, without using the process kill command? And, if I
have to use a process kill command, is there a way to set a return code to
be returned from the application?

Thanks!

Jim

Nov 20 '05 #4
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.

Nov 20 '05 #5
Hi James,

Have you tried my suggestion?
I look forward to hearing from you.

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.

Nov 20 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Kevin Chabot | last post by:
Hi I am developping an application, and it runs fine... It is a monitor utilitie and runs on the background... When I close the application for...
4
by: Tat | last post by:
Hello, I have a weird show stopper here. I created a Windows application (.NET 1.1). My dev. machine is not hooked up to the Internet, neither...
2
by: Jon Davis | last post by:
I have a full-blown application that consists of several (fifteen or so) assembly DLLs, each being a separate VS.NET project that outputs to the...
4
by: andersboth | last post by:
I want to run some code when my Windows Form Application is being shut down. I want to run this code when the Application is being shut down in...
0
by: Sakharam Phapale | last post by:
Hi All, I am developing an application which works similar to MS WORD. I have a main form which acts as MDI container and I am using a third...
6
by: Ben Finney | last post by:
Howdy all, I'm improving an existing application that's partly written using Python and the standard library. Many of the improvements I want to...
2
by: Aravind | last post by:
I have 3rd party dll plugin COM interface, when loaded executes the following functions. public class Test: IPlugin { public void...
3
by: davis | last post by:
Hi, I'm wrapping a 3rd party .NET 2.0 CF library which mandates Dispose be called. So, I mandate Dispose be called on my library...I follow...
5
by: Glen Buell | last post by:
Hi all, I have a major problem with my ASP.NET website and it's SQL Server 2005 Express database, and I'm wondering if anyone could help me out...
0
by: concettolabs | last post by:
In today's business world, businesses are increasingly turning to PowerApps to develop custom business applications. PowerApps is a powerful tool...
0
better678
by: better678 | last post by:
Question: Discuss your understanding of the Java platform. Is the statement "Java is interpreted" correct? Answer: Java is an object-oriented...
0
by: teenabhardwaj | last post by:
How would one discover a valid source for learning news, comfort, and help for engineering designs? Covering through piles of books takes a lot of...
0
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
0
jalbright99669
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
2
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...
0
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and...
0
Oralloy
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.