Help and Support

PRB: Unable to Load Control from C:\Path\File.ocx

Article ID:149565
Last Review:November 21, 2006
Revision:3.1
This article was previously published under Q149565
On This Page

SYMPTOMS

When you try to load an OLE Control generated by using ControlWizard into a Visual Basic 4.0 form in Visual Basic by on the Tools menu, clicking Custom Controls and then clicking the Browse button, the following error message appears:
"Unable to load control from: 'x:\path\file.ocx'"

Back to the top

CAUSE

Visual Basic checks an OLE control to see whether it supports self- registration by searching for the presence of an OLESelfRegister entry in the StringFileInfo section of the control's version information resource. ControlWizard-generated OLE controls do not provide the entry by default.

Back to the top

RESOLUTION

Modify the OLE Control to indicate its support for the self-registration feature. This can be achieved by including the OLESelfRegister entry with an empty value in the StringFileInfo section of the control's version resource. The following steps explain the process in detail.

Back to the top

Step-by-Step Procedure

1.Open the .rc file of the OLE Control as a Text file.
2.Find the StringFileInfo block under Version information.
3.Add the following line to the existing list of VALUE statements:
   VALUE "OLESelfRegister", "\0"
					
4.Build the OLE Control. Now you can load the OLE Control (.ocx file) by clicking Custom Controls on the Tools menu and clicking the Browse button.

Back to the top

STATUS

This behavior is by design.

Back to the top

MORE INFORMATION

A COM server typically indicates its support for self-registration by including the OLESelfRegister entry with an empty value in the StringFileInfo of its version resource. This entry is considered optional because the actual self-registration mechanisms do not depend on its presence. This information simply allows a client application to avoid loading a DLL (that is, an in-process server or OLE control) or launching an .exe (that is, a local server) for no gain.

The only requirement for an OCX/DLL to support the self-registration mechanism is to provide the entry points DllRegisterServer and DllUnregisterServer and export them. ControlWizard-generated OLE controls provide these two entry points and export them, though they do not indicate their self-registration support by not including the OLESelfRegister entry by default.

Back to the top

REFERENCES

Please refer to Chapter 5 of Inside OLE, Second Edition, for more information on self-registration.

Back to the top


APPLIES TO
Microsoft Foundation Class Library 4.2, when used with:
  Microsoft OLE Control Developer's Kit (CDK)
  Microsoft Visual Basic 4.0 Professional Edition
  Microsoft Visual Basic 4.0 32-Bit Enterprise Edition

Back to the top

Keywords: 
kbcode kbctrl kbprb KB149565

Back to the top

Article Translations

 

Other Support Options

  • Contact Microsoft
    Phone Numbers, Support Options and Pricing, Online Help, and more.
  • Customer Service
    For non-technical assistance with product purchases, subscriptions, online services, events, training courses, corporate sales, piracy issues, and more.
  • Newsgroups
    Pose a question to other users. Discussion groups and Forums about specific Microsoft products, technologies, and services.