Announcement

Collapse
No announcement yet.

How Do You Publish An Object

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • How Do You Publish An Object

    Please add your comments and suggestions as a Reply to this thread.





    PB/WIN - How do you publish an object?
    Publishing an object means making it available for access and use by other applications through the facilities of the COM Services of Windows. With some compilers, this requires pages upon pages of code. With PowerBASIC, you'll find it's fairly straightforward. Just add a Class Id (CLSID) GUID and the words "AS COM" to the end of the CLASS statement. Then, add an Interface ID (IID) to the end of the INTERFACE statement. Believe it or not, that's just about it!
    Code:
    $MyClassGuid = GUID$("{00000099-0000-0000-0000-000000000008}")
    $MyIfaceGuid = GUID$("{00000099-0000-0000-0000-000000000009}")
    CLASS MyClass $MyClassGuid AS COM
      INTERFACE MyInterface $MyIfaceGuid
        INHERIT IAutomation
        METHOD Method1(parm AS LONG)
          CALL abc(parm)
        END METHOD
      END INTERFACE
    END CLASS
    PowerBASIC handles all the messy details of COM for you. The name of the CLASS (in this case MyClass) will be used as the ProgID for COM registration of the DLL. The GUID's you selected will be used for the CLSID and IID, so you're ready to go...
    See Also
    Last edited by Gary Beene; 28 Oct 2014, 09:28 PM.
Working...
X