Samstag, 2. März 2013

Fix for ssubtmr6.dll (related to VB6 / Win7)

If you still develop or maintain applications written in VB6, you possibly use the component ssubtmr6.dll from Steve McMahon to simplify subclassing in your code. This component is also used by numerous other controls. It turned out that this DLL may cause a runtime error in a Win7 64bit environment that seems hard to track down. I experienced this bug at least with the control vbalsgrid6.ocx, which depends on ssubtmr6.dll. As the source code for both components is available, I could trace it down to a set of Win32 API function used by ssubtmr6.dll: GetProp() and SetProp(), which store a kind of name/value pair inside of a window class. It looks like the GetProp function in Win7 fails for an unknown reason with error 5. This may be related to UIPI (User Interface Privilege Isolation). So it's eventually not ssubtmr6.dll causing the bug, but the API function. I'm really not sure what's going on. Who knows ...

The error messages you will see if your component fails looks like this:

"Run time error 372. Failed to load control vbalgrid from vbalsgrid6.ocx. Your version of vbalsgrid6.ocx may be outdated. Make sure you are using the control provided with the application." - or simply: "Runtime error 0."

What's really annoying about this bug is the fact that the error won't disappear until you relogin to your Windows session. And it is even more annoying if this happens while you are coding!

Ok, enough said about the bug, here is the fix you are waiting for ;-) I simply replaced the API calls in ssubtmr6.dll with a VB dictionary object. I have used this solution in a well spread commercial app for more than a half year now, and it does fine. No more runtime errors.

The fixed version of ssubtmr6.dll is binary compatible with the original version. That means you don't have to recompile your apps, just replace the DLL file and you are done (and no need to do regsvr32, too). The class module CPropList.cls contains my replacement functions for the Get/SetProp APIs.

The original DLL and source code from the VBAccelerator web page can be found here:

http://www.vbaccelerator.com/home/VB/Code/Libraries/Subclassing/SSubTimer/article.asp

Download the fixed DLL (source and binary):

ssubtmr6_fixed.zip

Update 2013-16-03

Looks like there is a another fix out there, including an explanation what causes the problem (even if there remains the question why it happens only on Win7/64, not on XP). I have not tested this solution, but I think it's plausible. The article contains an excerpt of the ssubtmr6 source (msubclass.bas) that has to be fixed.

Link: Solution found in vbforums.com

1 Kommentar:


  1. Hello, I am trying to download the file but it no longer exists. I would appreciate it if you could send it to me by email: queputada @ gmail.com

    Thank you very much, you would do me a great favor

    AntwortenLöschen