473,587 Members | 2,580 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.D LL" (ByRef DataPath As
StringBuilder, ByRef MAXPath As StringBuilder) As Integer
Declare Function ShutdownMAXOrde r Lib "MAXORDR2.D LL" (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.GetCurr entProcess.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 1818
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.D LL" (ByRef DataPath As
StringBuilder, ByRef MAXPath As StringBuilder) As Integer
Declare Function ShutdownMAXOrde r Lib "MAXORDR2.D LL" (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.GetCurr entProcess.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.D LL" (ByRef DataPath As
StringBuilder, ByRef MAXPath As StringBuilder) As Integer
Declare Function ShutdownMAXOrde r Lib "MAXORDR2.D LL" (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.GetCurr entProcess.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.D LL" (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 ShutdownMAXOrde r Lib "MAXORDR2.D LL" (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.GetCurr entProcess.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.D LL" (ByRef DataPath As
StringBuilder, ByRef MAXPath As StringBuilder) As Integer
Declare Function ShutdownMAXOrde r Lib "MAXORDR2.D LL" (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 ShutdownMAXOrde r, you will pass a handle
to the function, I guess it should be an ObjectHandle which is need to be
terminated by the ShutdownMAXOrde r 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.GetLast Win32Error to check if there is any error.
Marshal.GetLast Win32Error Method
http://msdn.microsoft.com/library/de...us/cpref/html/
frlrfSystemRunt imeInteropServi cesMarshalClass GetLastWin32Err orTopic.asp
Also you may try to simplify the sample which works in VB6.( e.g. just call
the InitMAXOrder and ShutdownMAXOrde r) 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
2234
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 example with Form1.Close() it shuts down succesfully But when windows tries to shut it down (by logging off or by shutting down your computer), an end task window pops up for...
4
1579
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 it has firewall. I installed the app on a different machine with Internet connection and Norton Security Family Edition 2001.
2
1560
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 main DLL's bin directory. They are all strongly named. I have registered the main DLL, which references the other DLLs, to the GAC cache. I have built a plug-in for a third party application with...
4
1877
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 the following situation: 1. The App is being shut down by the user. 2. The App is being shut down because of Windows System Shut Down. 3. The App Process is being killed in Task Manager
0
1308
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 party menu control so that it looks like XP style menu having image on left side of menu item. When using the standard menu bar, child form icon appears before the menu and in same level.
6
1928
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 make can be done by using third-party free software. The immediate customer for this application is happy to install Python on their machine, but I'd like to remove the hassle of asking them to...
2
1847
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 Innitialize(IPluginApp obj, int pluginHandle) { //gets the plugin obj dynamically to work with third party application. //can be added events etc. }
3
1662
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 the Disposable pattern described on MSDN...and I Dispose of the wrapped 3rd party library in there. My library is meant to be used in Forms.
5
14421
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 with it. This site is on a webhost (WebHost4Life) and was running fine and dandy, until I decided I needed to add some additional stored procedures to the database.
0
7843
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8340
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7967
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
8220
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5713
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3840
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3875
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2353
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
1185
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.