HOW to Kill ActiveX application..

Hi,

I'm developing a application which uses activex plugin (used to load map files) it works fine in .net the problem is while closing the application the application won't close properly i mean application will be in task manager and manually go to task bar and kill the application. I tried the manually Killing the app using process class in vb.net but the same thing is not working in c# .

Is there some other method to kill the application ...

Pls guide me..

regards
BS

[489 byte] By [bsraju.net] at [2007-12-16]
# 1

Hi,

Are you trying to kill your own app? If that's so, I don't think that it's possible. If your ActiveX plugin is causing your app not to unload properly (or at all in your case). You should find a way to shutdown or dispose the plugin before your app closes...

Or you could use the application.Exit() method to force shutting everything down...

cheers,

Paul June A. Domag

PaulDomag at 2007-9-9 > top of Msdn Tech,Visual C#,Visual C# General...
# 2
Hi Paul,

u r right , my activex plugin is causing the problem , if i don't use the activex plugin the app works fine ... How do i dispose the activex plugin , i guess it was not developed properly..

I tried application.extit() method but still it will be there in task manager..

Is there any method to dispose the plugin before closing the app
Pls guide...
Thanks and regards,
bsraju

bsraju.net at 2007-9-9 > top of Msdn Tech,Visual C#,Visual C# General...
# 3

Hi,

I think this activex plugin is not entirely for the .net framework. Is the plugin showing in the taskbar? If its an activeX then I guess that .net is generating a wrapper for the it. Could you explore the generated wrapper? I mean the object that you are using. Maybe there's a proper disposing function for the activex...

cheers,

Paul June A. Domag

PaulDomag at 2007-9-9 > top of Msdn Tech,Visual C#,Visual C# General...
# 4
HI,

Yes i, guess the activex plugin in not .net framework . Plugin is not showing in taskbar , the app won't be there in Task manager > Applications but it will be there in Task manager > Processes ...

I'm using the following way to kill the app



Dim xyz As Process
For Each xyz In System.Diagnostics.Process.GetProcesses()
If InStr(xyz.ProcessName, "Processone.2.0", CompareMethod.Text) > 0 Then
xyz.Kill()
End If
Next
End


bsraju.net at 2007-9-9 > top of Msdn Tech,Visual C#,Visual C# General...
# 5

Hi,

Is there a Dispose(), Quit() or Exit() function in the ActiveX plugin? Coz I doubt that you could kill your own process if the ActiveX pliugin is not killed first..

cheers,

Paul June A. Domag

PaulDomag at 2007-9-9 > top of Msdn Tech,Visual C#,Visual C# General...
# 6
HI Paul,

Thanks for the solution but this above function works only in visual studio 2005 but not in visual studio 2003.I'm using dispose method to kill the activex plugin it isworking fine in 2005

following is the code in VS2005

Private Sub frmmain_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
xyz.Dispose()
zxy.Dispose()
Application.DoEvents()
Application.Exit()
End Sub

where xyz and zxy are activex plugins...

code in visual studio 2003

Private Sub frmmain_Closing(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles MyBase.Closing
xyz.Dispose()
zxy.Dispose()
Application.DoEvents()
Application.Exit()
End Sub

when i use the above code while closing the app i'm getting following error.
The instruction at "0x73dd11c7" referenced merory at ..... . The memory could not be read
Click ok to terminate the program.

is there any difference in code ?
then why isn't working in 2003...

bsraju.net at 2007-9-9 > top of Msdn Tech,Visual C#,Visual C# General...