Page 1 of 1

What is _USRDLL and why autohotkey.dll v2 (alpha) doesn't call UnregisterClass when it's defined?

Posted: 24 Nov 2017, 13:53
by salowabicz
Asking this because I'm using the advertised "multi-threading by loading a dll multiple times and using its exported functions" approach to execute multiple scripts on the fly. However, there are some legacy scripts which autohotkey.dll v2 (alpha) refuses to run. So, I'm trying to execute them using the autohotkey.dll v1.1, but all I get is the mysterious "RegClass" message. I found out that this happens because the previously loaded autohotkey.dll v2 (alpha) did not call UnregisterClass to unregister "AutoHotkey" window class.

Both dlls I use are lastest compiled releases (Win32w).

Re: What is _USRDLL and why autohotkey.dll v2 (alpha) doesn't call UnregisterClass when it's defined?

Posted: 24 Nov 2017, 17:10
by HotKeyIt
Which version are you using and how do you create additional threads?

_USRDLL is a directive for code that exists only for AutoHotkey.dll and not AutoHotkey.exe.
I have added UnregisterClass for AutoHotkey.dll.

Re: What is _USRDLL and why autohotkey.dll v2 (alpha) doesn't call UnregisterClass when it's defined?

Posted: 25 Nov 2017, 07:59
by salowabicz
Thanks for quick reaction. As I said, I was using latest compiled binaries (Win32W) from http://hotkeyit.github.io/v2/. As for threading, I'm loading the dll from memory for each thread. The problem occured if autohotkey.dll v2 was unloaded, and autohotkey.dll v1.1 was loaded into the same address space afterwards. In this case both dlls were using the same hInstance, but autohotkey.dll v2 forgot to call UnregisterClass before unloading. This resulted in failure of autohotkey.dll v1.1 registering the class. Normally, this error would occur with autohotkey.dll v2 alone, unless its "RegClass" check was stripped out. Anyways, thanks for fixing the issue.

Re: What is _USRDLL and why autohotkey.dll v2 (alpha) doesn't call UnregisterClass when it's defined?

Posted: 25 Nov 2017, 08:36
by HotKeyIt
I see, thanks for pointing out.