2
votes
How to compile Winsock Control 6.0 on VB6 in Windows 10? - Stack Overflow
Asked
Viewed 2k times
2

When trying to compile in the "Winsock Control" component on Windows 10, I get this error:

mswinsck.ocx could not be loaded

image

Notably, I have installed VB6 SP6, and with SP6 it works great on Windows 8.1 and Windows 7, but it won't compile on Windows 10.

Also notably, the compiled .exe, when compiled from Win7/8, has no problem loading ws2_32.dll. It's just the compiling step that doesn't work on Win10.

Running Dependency Walker, depends.exe suggests mswinsck.ocx can't be loaded because it's depending on API-MS-WIN-CORE-SYNCH-L1-2-0.DLL and API-MS-WIN-CORE-PROFILE-L1-1-0.DLL and API-MS-WIN-CORE-PROCESSTHREADS-L1-1-0.DLL and a bunch of other DLLs with similar names (I think these DLLs have something to do with SysWOW64), which can't be found:

image

Does anyone know how to compile in "Winsock Control" in VB6 on Win10?

(Also notably, it seems the MSFlexGrid component is un-compilable on Win10 in a similar fashion, but this question is about the WinSock control, not MSFlexGrid).

EDIT: additional info: I have installed "VB6 Service Pack 6", VB version is "Version 9782 VBA retail 6.0.9782", and the version on the mswinsck.ocx file itself is 6.1.97.82 (and thanks to the comments, I know a newer one exists: 6.1.98.16)

5
  • 1
    Unfortunately, I cannot reproduce the problem. Both WinSock and MSFlexGrid compile fine on my Win10 computer. Aug 26 2020 at 13:02
  • @BrianMStafford good news for me, do you know which Windows Updates release channel you are on? (Insider or Semi-Annual or LTSC or the default one?) also can you get me a checksum (MD5 or SHA1 or CRC or anything) on your mswinsck.ocx file? (for example 7zip allows you to get various checksums of files, the sha1 of my mswinsck.ocx is 4E97BF9519C83835DA9DB309E61EC87DDF165167 )
    – hanshenrik
    Aug 26 2020 at 13:37
  • I don't know about my Release Channel, but the "CRC checksum for data" is 39A6C54D. Aug 26 2020 at 13:58
  • @BrianMStafford strange, my mswinsck.ocx's CRC32 is 6099DCFB - can you upload your copy of mswinsck.ocx somewhere? (gdrive/OneDrive/mega.nz or ratma.net/upload.php or anywhere)
    – hanshenrik
    Aug 26 2020 at 14:17
  • @BrianMStafford thank you! weird indeed, your mswinsck.ocx have version 6.1.98.16, my copy have version 6.1.97.82, your is newer than mine! (also your copy was signed by microsoft in 2009, my copy was signed by microsoft in 2004) - but it seems that's not the whole story, replacing my copy with yours didn't change the errors i'm getting.. wonder where your file comes from (probably a package, possibly from Windows Updates itself? idk)
    – hanshenrik
    Aug 26 2020 at 14:41
5

I have run into this problem often on Windows 10 machines and resolved it by unregistering and re-registering each OCX using an elevated Command Prompt:

  1. Open a Command Prompt window from the Start Menu by right-clicking it and choosing "Run as administrator". It is important that your Command Prompt window is titled "Administrator: Command Prompt".
  2. Go to SysWOW64 folder by typing cd \Windows\SysWOW64
  3. Unregister OCX by typing regsvr32 -u mswinsck.ocx
  4. Re-register OCX by typing regsvr32 mswinsck.ocx

That usually fixes the problem.

If you use Visual Studio Installer 1.1 to deploy applications, you will probably have the same issue on Windows 10 systems you deploy to. The installer doesn't seem to properly register files. If you use Visual Studio 2019 and the Setup extension, that will build an installer that properly registers the OCX, in my experience.

3
  • that actually fixed it! also doing the same with msflxgrd.ocx fixed the same problem with MSFlexGrid! thanks
    – hanshenrik
    Aug 27 2020 at 0:52
  • Glad it worked! You will probably have to do this for other OCX down the line. It's not a pretty solution but it works. Aug 27 2020 at 0:59
  • well trying to compile a ~140,000 lines VB6 project, it was only mswinsck.ocx and msflxgrd.ocx that wouldn't compile ^^ (idk how big it is, but it was 133,445 lines on 2016-09-03, and grown since then)
    – hanshenrik
    Aug 28 2020 at 9:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.

 
1
Unfortunately, I cannot reproduce the problem. Both WinSock and MSFlexGrid compile fine on my Win10 computer.Brian M Stafford
@BrianMStafford good news for me, do you know which Windows Updates release channel you are on? (Insider or Semi-Annual or LTSC or the default one?) also can you get me a checksum (MD5 or SHA1 or CRC or anything) on your mswinsck.ocx file? (for example 7zip allows you to get various checksums of files, the sha1 of my mswinsck.ocx is 4E97BF9519C83835DA9DB309E61EC87DDF165167 )hanshenrik
I don't know about my Release Channel, but the "CRC checksum for data" is 39A6C54D.Brian M Stafford
@BrianMStafford strange, my mswinsck.ocx's CRC32 is 6099DCFB - can you upload your copy of mswinsck.ocx somewhere? (gdrive/OneDrive/mega.nz or ratma.net/upload.php or anywhere)hanshenrik
@BrianMStafford thank you! weird indeed, your mswinsck.ocx have version 6.1.98.16, my copy have version 6.1.97.82, your is newer than mine! (also your copy was signed by microsoft in 2009, my copy was signed by microsoft in 2004) - but it seems that's not the whole story, replacing my copy with yours didn't change the errors i'm getting.. wonder where your file comes from (probably a package, possibly from Windows Updates itself? idk)hanshenrik

1 Answers

5
votes

I have run into this problem often on Windows 10 machines and resolved it by unregistering and re-registering each OCX using an elevated Command Prompt:

  1. Open a Command Prompt window from the Start Menu by right-clicking it and choosing "Run as administrator". It is important that your Command Prompt window is titled "Administrator: Command Prompt".
  2. Go to SysWOW64 folder by typing cd \Windows\SysWOW64
  3. Unregister OCX by typing regsvr32 -u mswinsck.ocx
  4. Re-register OCX by typing regsvr32 mswinsck.ocx

That usually fixes the problem.

If you use Visual Studio Installer 1.1 to deploy applications, you will probably have the same issue on Windows 10 systems you deploy to. The installer doesn't seem to properly register files. If you use Visual Studio 2019 and the Setup extension, that will build an installer that properly registers the OCX, in my experience.