4 posts / 0 new
Last post
Library File Error - "Class Not Registered"
  • Hello everyone.
    • Sorry for the outline form. 
    • I was unaware the posting process stripped newline characters from the post.
  • The Background -
    • We have a Soft Phone application that is written in Delphi (O.O.D. Pascal) for Windows.
    • The ability to answer an incoming call by activating the answer button on the Plantronics Wireless Headset was recently requested.
    • The MSI files were downloaded and executed, and the Plantronics SDK was downloaded as well and converted / altered into a Delphi Library File.
    • I then started to follow the "First Steps" section of the Plantronics website. 
    • I knew that the "First Steps" code would have to be tweaked to fit the Delphi system.
  • The Problem -
    • In adjusting the code to work within Delphi, a few translations problems were encountered and resolved.
    • One error is proving to be stubborn - when an instance of one specific class is created, the error "Class not registered" is thrown.
      • "First Steps" code for reference -
        • //  Connect to the Plantronics COM API:
          • myAppName = "SDK .NET COM sample";
          • sessionManager = new COMSessionManager();
          • sessionManager.Register(myAppName, out session);
        • //  Hook to SessionManager events:
          • sessionManagerEvents = sessionManager as ICOMSessionManagerEvents_Event;
          • if (sessionManagerEvents != null)
          • {
            • sessionManagerEvents.onCallStateChanged += SessionManagerEvents_onCallStateChanged;
            • sessionManagerEvents.onDeviceStateChanged += SessionManagerEvents_onDeviceStateChanged;
          • }
      • Delphi Code -
        • //  Connect to the Plantronics COM API:
          • plugin_name := "Plugin Name";
          • the_session := CoCOMSession.Create;
          • session_manager := CoCOMSessionManager.Create;
          • session_manager.Register(plugin_name, the_session);
        • //  Hook to Session Manager events:
          • state_device_event_args := CoCOMStateDeviceEventArgs.Create;
          • call_event_args := CoCOMCallEventArgs.Create;
  • The problem is the bold line of the Delphi code. 
    • A CoCOMSession (the_session), a CoCOMSessionManager (session_manager), and a CoCOMStateDeviceEventArgs (state_device_event_args) objects are created without issue. 
    • However, attempting to create a CoCOMCallEventArgs object (call_event_args) throws a "Class Not Registered" error, even though it is declared and implemented in the library file along with the other three.
  • Excerpts from the Library file:
    • Class Declaration:
      • IID_ICOMCallEventArgs: TGUID = '{0280956C-C644-4CD8-B124-C8A99E5D505E}';
      • CLASS_COMCallEventArgs: TGUID = '{705129C3-2265-4F10-9768-0FF8A20234C0}';
    • Class creation function:   
      • class function CoCOMCallEventArgs.Create: ICOMCallEventArgs;
      • begin
        • Result := CreateComObject(CLASS_COMCallEventArgs) as ICOMCallEventArgs;
      • end;
Every tutorial / forum answer about resolving the "Class Not Registered" error that I have found has not resolved the issue. Does anyone have any advice / insight as to what I have been doing wrong? Thank you.  

Hi Duncan,<br /> <br /> Declaring and implementing the class in the library file is not enough. It also must be registered in Computer\HKEY_CLASSES_ROOT in the registry.<br /> <br /> For example the Plantronics SDK has the following class registered (this is the COMSessionManagerClass):<br /> <br /> HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{750B4A16-1338-4DB0-85BB-C6C89E4CB9AC}<br /> <br /> When Plantronics Hub or Plantronics SDK is installed, this class GUID can be found in the registry under Computer\HKEY_CLASSES_ROOT.<br /> <br /> Can you confirm if the class (GUID) you are trying to use exists in the registry?<br /> <br /> Thanks!<br /> Lewis<br /> &nbsp;

All of the classes are in the registry, except for the one in question. Upon adding it to the registry, the system was still throwing the &quot;Class not registered&quot; error.<br /> The issue has been (potentially) resolved by the following - <ul> <li>I had mistakenly thought from the tutorial / first steps section that a &quot;COMCallEventArgs&quot; object needed to be created before it could be used.&nbsp;</li> <li>Upon further review, the COMCallEventArgs object gets created when necessary at a later point.</li> </ul> <br /> More testing needs to be done, but I believe this issue is resolved.

Good to hear! Let me know if further questions!

Add new comment