What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » Unloading a dll

Pages: (2): « First [ 1 ] 2 » Last »
Unloading a dll
Author: Message:
cooldude_i06
Full Member
***

Avatar
I'm so cool I worry myself.

Posts: 272
Reputation: 9
– / Male / –
Joined: Sep 2003
O.P. Unloading a dll
I'm using a custom ActiveX Dll. For some reason the dll won't unload until WLM exists, even if the script is stopped. This happens even if all I do is create an activexobject and not use it further at all. Is there anything special I need to do to free up the dll.

Btw, The Class_Terminate event does fire, but dll still remains in memory.
The delete operator, or setting ActiveXObject to null does not help.

This problem makes it hard for any script that uses ActiveX dll to be removed. You must stop the script, restart WLM, and then delete the script.

Thanks
CD

This post was edited on 07-03-2006 at 01:55 AM by cooldude_i06.
[Image: clb2.jpg]
07-02-2006 11:55 PM
Profile E-Mail PM Web Find Quote Report
Mike
Elite Member
*****

Avatar
Meet the Spam Family!

Posts: 2795
Reputation: 48
31 / Male / Flag
Joined: Mar 2003
Status: Online
RE: Unloading a dll
I had asked the same thing on the beta testing forums a while ago.
My DLL also wouldn't unload.

It seems that there is no way of unloading your ActiveX DLL... :(
YouTube closed-captions ripper (also allows you to download videos!)
07-03-2006 12:03 AM
Profile E-Mail PM Web Find Quote Report
deAd
Scripting Contest Winner
*****

Avatar

Posts: 1060
Reputation: 28
– / Male / Flag
Joined: Jan 2006
RE: Unloading a dll
did you try:
code:
//create activexobject
var MyVar = new ActiveXObject(...);
//delete the object
delete MyVar;

07-03-2006 12:20 AM
Profile PM Find Quote Report
aNILEator
Skinning Contest Winner
*****

Avatar
...in the wake of the aNILEator

Posts: 3718
Reputation: 90
35 / Male / Flag
Joined: Oct 2003
Status: Away
RE: Unloading a dll
hey deAd have you given that to alex, because itunes+ still has problems unloading that .dll :(
07-03-2006 12:36 AM
Profile PM Web Find Quote Report
deAd
Scripting Contest Winner
*****

Avatar

Posts: 1060
Reputation: 28
– / Male / Flag
Joined: Jan 2006
RE: Unloading a dll
No, I didn't know that alex was having problems. I'll talk to him. Also, I haven't tested that, not sure if it works completely...
07-03-2006 12:50 AM
Profile PM Find Quote Report
cooldude_i06
Full Member
***

Avatar
I'm so cool I worry myself.

Posts: 272
Reputation: 9
– / Male / –
Joined: Sep 2003
O.P. RE: Unloading a dll
quote:
Originally posted by deAd
did you try:
code:
//create activexobject
var MyVar = new ActiveXObject(...);
//delete the object
delete MyVar;




the delete operator doesnot help
[Image: clb2.jpg]
07-03-2006 01:35 AM
Profile E-Mail PM Web Find Quote Report
deAd
Scripting Contest Winner
*****

Avatar

Posts: 1060
Reputation: 28
– / Male / Flag
Joined: Jan 2006
RE: Unloading a dll
oh ok, as i said, didn't know for sure if that works :$
07-03-2006 01:39 AM
Profile PM Find Quote Report
matty
Scripting Guru
*****


Posts: 8336
Reputation: 109
39 / Male / Flag
Joined: Dec 2002
Status: Away
RE: Unloading a dll
Well I just realized the way of doing it (I actually forgot I did this with coding Plugins I was coding in VB so I could overwrite them.)

@echo off
reloadplugins.exe
regsvr32 /u /s "C:\program files\messengerplus! 3\plugins\screenshotsender.dll"
reloadplugins.exe
del /q "C:\program files\messengerplus! 3\plugins\screenshotsender.dll"
Echo Compile the dll now.
pause
regsvr32 /s "C:\program files\messengerplus! 3\plugins\screenshotsender.dll"
reloadplugins.exe

So basically I reloaded and unregistered the dll so that it could be deleted. Something like this would need to be done so that the DLL could be deleted.

This post was edited on 07-03-2006 at 02:47 AM by matty.
07-03-2006 02:39 AM
Profile E-Mail PM Find Quote Report
cooldude_i06
Full Member
***

Avatar
I'm so cool I worry myself.

Posts: 272
Reputation: 9
– / Male / –
Joined: Sep 2003
O.P. RE: Unloading a dll
quote:
Originally posted by Matty
Well I just realized the way of doing it (I actually forgot I did this with coding Plugins I was coding in VB so I could overwrite them.)

@echo off
reloadplugins.exe
regsvr32 /u /s "C:\program files\messengerplus! 3\plugins\screenshotsender.dll"
reloadplugins.exe
del /q "C:\program files\messengerplus! 3\plugins\screenshotsender.dll"
Echo Compile the dll now.
pause
regsvr32 /s "C:\program files\messengerplus! 3\plugins\screenshotsender.dll"
reloadplugins.exe

So basically I reloaded and unregistered the dll so that it could be deleted. Something like this would need to be done so that the DLL could be deleted.

I discovered something using your method...

First I stopped the script, unregistered the dll, and deleted the dll - it worked fine.
Next time I stopped the script, unregistered the dll, and tried removing the dll from Plus Preferences - it did not work.
Then I stopped the script, left the dll registered, and deleted it - it worked.
Then I stopped the script, left the dll registered and tried deleting it from Plus Preferences - it did not work.

Finally, I stopped the script, close the WLM main window, then tried removing the script from Plus Preferences - it worked.

Thus I discovered that the dll is only locked until the WLM window is open. You can even leave WLM running, just close the main window, and the dll becomes unlocked. Unfortunately this means that unregistering a dll won't help unload a dll.

EDIT:

Here's the method I'm going to use.

Script contains the dll, but does not register it in ScriptInfo.xml.

When script is run it copies the dll to a different directory. Before doing this it checks if the dll already exists in new directory or not. It also registers the dll after copying it.

Script now uses this dll copied to a different directory. Now that this dll is in a different directory, when the script is deleted the dll in its directory won't be the one that is locked, and won't deny access.

This is the only method that I can think of to solve this problem. Hopefully as more people use dll's they'll come up with a better solution.
[Image: clb2.jpg]
07-03-2006 08:38 AM
Profile E-Mail PM Web Find Quote Report
felipEx
Scripting Contest Winner
***


Posts: 378
Reputation: 24
35 / Male / Flag
Joined: Jun 2006
RE: Unloading a dll
Interop.FreeDll("your_dll_libray.dll");
FreeDll("your_dll_libray.dll");

*-)
07-03-2006 09:53 AM
Profile E-Mail PM Find Quote Report
Pages: (2): « First [ 1 ] 2 » Last »
« Next Oldest Return to Top Next Newest »


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On