Quantcast
Channel: Visual COBOL - Forum - Recent Threads
Viewing all articles
Browse latest Browse all 4356

RE: Cannot access doc info

$
0
0

Unfortunately he links in that article are to are old knowledgebase that does not exist anymore.
One of the links is available as a new link and the other no longer exists.

The new link is:

community.microfocus.com/.../2415.translating-com-automation-errors-to-get-their-meaning.aspx

The text of the second article which has no link is as follows:

How to verify (if registered or not), register, unregister an ActiveX control?

Instantiating an unregistered or non-existent ActiveX control from a Cobol program would result to the following error:

          -----

          Exception 65537 not trapped by the class oleexceptionmanager.
          Description: "Server defined OLE exception"
          (800401F3): Invalid class string
          Hit T to terminate program. Hit any other key to continue.

          -----

Solution:

Use the olesup class (isServerRegistered) to check if a control is registered:

          invoke olesup 'isServerRegistered' using ole-server-name *>pic x(256) - null-terminated
                                  returning hresult *> pic 9(9) comp-5
          if hresult not = zero  *>activex not registered
To register an ActiveX control, call the DllRegisterServer entry point within the DLL:
             call win32api 'LoadLibraryA'
                     using by reference z'ActiveXFile.dll'
                 returning activex-handle *> pointer
             if activex-handle not = NULL
                 call win32api 'GetProcAddress'
                         using by value     activex-handle
                               by reference z'DllRegisterServer'
                     returning proc-ptr *>procedure-pointer
                 call win32api proc-ptr *>register activex
                 if return-code = zero
                     display '***ActiveX successfully registered'
                 else
                     display '***Unable to register ActiveX'
                     stop run
                 end-if
             else
                 display '***Could not load/found ActiveX'
                 stop run
             end-if

To unregister an ActiveX control, call the DllUnregisterServer entry point within the DLL. This can be done exaclty as above with the exception of replacing the DllRegisterServer reference to DllUnregisterServer.


Viewing all articles
Browse latest Browse all 4356

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>