0

I was given a test program by one of my friends well compiled and the challenge was to edit the source code. I got to know the program was written in VB6 and I got the vb-decompiler. I got lots of forms (.frm files) and a project.vbp . Now, I downloaded the VB6 for Windows from unofficial sources and when I import my project, I get out of memory error on every form. I ignore the error and when import is complete, It give a message about a log file -

Line 77: Cannot load control txtServer.
Line 85: Cannot load control txtUID.
Line 93: Cannot load control txtPwd.
Line 101: Cannot load control txtFTPPath.
Line 109: Cannot load control txtFTPSharedFolder.
Line 117: Cannot load control txtPort.
Line 222: Cannot load control txtType.
Line 266: Cannot load control txtPath.
Line 274: Cannot load control txtSharedFolder.
Line 310: Cannot load control cmdSave.

I tried to update my vb6 to vb.net through visual basic 2008 express but I get errors

upgrade failed: application has caused an exception

What should I do now? Edit : I read the frm file. I opened the frm file and saw it had lines like -

begin xyz.txtServer

Now xyz is the name of application and txtServer is the error in the log file as stated in the question.

Edit 2: I have a new development. I opened the frm file and got to know that the line having - begin VB.(some Command) runs perfectly but the line - begin xyz2000(some command) gives error. It is clear that it is dll error. The frm does not call any xyz2000.dll . I did not get any xyz2000.dll in the software given to me. So where did this xyz2000 came from?

  • VB.NET is not a true successor to VB6, it is an entirely different language & programming environment which has a lot of superficial similarities. So that probably won't be a good quick fix to the problem you have. – StayOnTarget Jun 27 '19 at 11:16
  • related https://stackoverflow.com/questions/31268991/how-to-fix-the-error-cannot-load-control-tabstrip-in-vb6-program – StayOnTarget Jun 27 '19 at 11:20
  • 1
    I think you should probably find something more productive to do with your life. This friendly challenge is gonna waste a lot of hours – Caius Jard Jun 27 '19 at 13:55
  • @DaveInCaz The VB.NET language itself is close to being a superset of VB; the huge differences are in the libraries, especially between the WinForms of VB.NET and the Ruby forms library of VB. – R.J. Dunnill Jul 13 '19 at 17:22
  • @R.J.Dunnill Ruby? – StayOnTarget Jul 14 '19 at 01:41
  • Ruby was the code name of Visual Basic's programmable forms engine. – R.J. Dunnill Jul 14 '19 at 01:51

2 Answers2

3

The "cannot load" errors are most likely due to DLL (or OCX files, a type of DLL) references which are missing or at least not registered on your development computer. VB6 is not a statically linked language, or even truly dynamically linked, but instead DLL references are all discovered at runtime based on COM - essentially meaning that DLLs generally have to be centrally registered in Windows.

To further diagnose the specific issues:

  • Look in the FRM files in a text editor. File where the control "txtServer" is defined and what type it is. The type name may indicate which DLL is required to provide the control.

  • Look the top of the FRM files, you should see lines listing Object = "..." references. These also indicate required DLL / OCX files.

  • Look in the .VBP file, you will see similar Object and Reference lines.

(If you add some examples of those items to the question people may be able to provide more help.)

StayOnTarget
  • 11,743
  • 10
  • 52
  • 81
  • I had nearly ten .dll files in the program sent by my friend. I just tried to register them centrally, but only half were registered. Others gave error such as not a valid entry point was found or version error not compatible in both 32bit and 64bit regsvr32. I suppose the really main ones were registered. – Bhavya Gupta Jun 27 '19 at 12:47
  • @BhavyaGupta it can be the case that some DLLs are not COM dependencies and therefore don't require registration. i.e., a COM DLL can have a non-COM DLL as a dependency. Also VB6 can directly use such DLLs (but not for controls). So you may be OK based on those errors. VB6 is 32-bit so it is always the 32-bit regsvr32 you should be using, AFAIK. And you must make sure to run regsvr32 as admin (which it seems like you probably did). – StayOnTarget Jun 27 '19 at 14:57
  • Should I send you source code for compiling. Any help will be appreciated. – Bhavya Gupta Jun 27 '19 at 16:32
  • @BhavyaGupta this does nto seem to be a coding problem, but a development environment problem. You need to work through each error one-by-one. – StayOnTarget Jun 27 '19 at 18:12
  • I have a new development. I opened the frm file and got to know that the line having - begin VB.(some Command) runs perfectly but the line - begin xyz2000(some command) gives error. It is clear that it is dll error. The frm does not call any xyz2000.dll . I did not get any xyz2000.dll in the software given to me. So where did this xyz2000 came from? – Bhavya Gupta Jun 28 '19 at 05:00
  • @BhavyaGupta could you have a missing DLL? – StayOnTarget Jun 28 '19 at 09:49
  • I have all the dll that I got from the software. There were two exe files when the software Installed. Both run the same thing. One was smaller than other. Should I decompile the other? – Bhavya Gupta Jun 28 '19 at 09:55
  • @BhavyaGupta that is confusing... I would do so just to see what you might learn. – StayOnTarget Jun 28 '19 at 10:12
  • Thanks DavelnCaz, what should I do now to get the log. I have got another development. The program created a shortcut which runs in /appdata/roaming/microsoft/installer/(GUID)/(something).exe. The exe is not running itself alone. I could not find that guid in regedit too. – Bhavya Gupta Jun 28 '19 at 10:52
0

You should definitely carefully examine the .vbp file. The Reference and Object statements GUID's must appear in the registry's HKEY_CLASSES_ROOT\TypeLib key.

Those are the components you register with regsvr32. For the dll's you couldn't register, they have to be copied to a location accessible by 32-bit applications. The best location is:

On 64-bit Windows

%SystemRoot%\SysWOW64

On 32-bit Windows

%SystemRoot%\System32

Milan Oparnica
  • 180
  • 2
  • 7