Re: Terminate a called DLL from within the DLL
- From: "Ken Halter" <Ken_Halter@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Wed, 6 Jul 2005 09:22:18 -0700
"Larry" <bliff@xxxxxxxxxx> wrote in message
news:eyPg0NkgFHA.3940@xxxxxxxxxxxxxxxxxxxxxxx
> Exit Sub only exits the currently running procedure
> in the DLL. I want to stop the DLL from executing
> and the vb 6 application that called it.
>
> I can make the executing Thread exit the DLL
> but then it just goes back to the calling VB app
> and continues.
About the best you can do... and still be "compliant", is to raise an error.
Similar to trying to use a control that's not licensed. All it does is raise
an Error 429 in its Initialize event. That causes the component to never
"come to life". The calling app can trap the error and take action.
ActiveX Component Standards and Guidelines
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcon98/html/vbconolecomponentstandardsguidelines.asp
ActiveX Component Shutdown
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcon98/html/vbconolecomponentshutdown.asp
Visual Basic Component Shutdown Rules
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcon98/html/vbconvisualbasiccomponentshutdownrules.asp
Trying to force a DLL to shut itself down can get tricky. Especially if the
calling app's not yours. To, basically, rip it out of ram, would leave
references behind in the calling app and it would probably take the task
manager's End Task button to shut the caller down. imo, the best way would
be to define an error code that the caller can watch for. If it gets the
error, release the reference to the DLL and it should "die" on its own.
--
Ken Halter - MS-MVP-VB - http://www.vbsight.com
DLL Hell problems? Try ComGuard - http://www.vbsight.com/ComGuard.htm
Please keep all discussions in the groups..
.
- References:
- Terminate a called DLL from within the DLL
- From: Larry
- Re: Terminate a called DLL from within the DLL
- From: Michael C
- Re: Terminate a called DLL from within the DLL
- From: Larry
- Terminate a called DLL from within the DLL
- Prev by Date: Re: Programatically design a form
- Next by Date: New functions in .NET 2.0 ???
- Previous by thread: Re: Terminate a called DLL from within the DLL
- Next by thread: Re: simple counter variable.
- Index(es):