0
votes

When I try to load a form in the designer, it shows "runtime error 0" and produces a log file which contains:

Line 15: Cannot load control xxxx; license not found.

But the control in question DOES NOT have any licensing restrictions. It has no installer and requires only registration (regsvr32).

Not only that, but for years this had worked without any problems and only just recently this has started. It affects a number of forms which have any controls from a particular OCX.

So it appears that something is fooling VB6 into either thinking a license check has failed, or at least to show a nonsensical error message.

I have tried to trace this using Process Monitor but I couldn't spot any useful clues in the logs. At least, nothing which was obviously problematic.

Any ideas what could cause this? I'm at a loss so far to find a cause.

Thanks

2

2 Answers

0
votes

I'm assuming this is a third-party OCX... Many such products came with their own installer which generates the license file; simply copying, and even regsvr32ing the .ocx is not sufficient to use it in the development environment. If you still have the original installation routine, you can try running that to regenerate the license. Failing that, you could look for an appropriately-named .lic file on an existing, working development machine (in \Windows\System32, or the VB6 installation directory, or in the directory into which the .ocx is installed) and manually copy that to the same place on the new development machine.

0
votes

(Answering my own question, should anyone else run into this again).


As far as I can determine this error was caused by either a subtly corrupt FRX file and/or an FRM/FRX file pair being out of sync.

By going back in source control I could eventually locate a revision where there was no problem. This alone seemed to eliminate anything in the computing environment from being the cause. (ie, bad VB6 installation, disk space, etc. etc.)

I manually re-did certain changes and brought that older code back up to date, and so far the problem has not reappeared.


EDIT the struck-out text was not incorrect but was not specific enough -- I have since learned what seems to be the root cause.

The problem was that we loaded a 32-bit ICO file (icon) into an imagelist in one of the VB6 forms. Now, traditionally 32-bit color icons were not usable in VB6 and you would get an error even trying to do this. However for some reason certain Windows PCs will now allow this - which can be a time bomb.

The problem is: forms saved that way can cause the errors in this question when run on a different PC which does NOT support such icons.

This will occur in the IDE when the form is loaded, OR if a compiled EXE is run on a different computer which respects the original VB6 icon limitations!

I don't know why the totally meaningless "licensing" error message is shown when this happens.

In my case we didn't intentionally introduce this icon, it was a mistake, and so it took a LONG time to debug and eventually figure this out (plus some very valuable advice from people on VBForums).

I've created a different question specifically to try and get at what underlying element of Windows has changed causing this problem.