' COM Object Reference — IUnknown AddRef/Release via DECLARE
#COMPILE EXE
#DIM ALL

DECLARE FUNCTION CoInitialize LIB "OLE32.DLL" (BYVAL pvReserved AS LONG) AS LONG
DECLARE FUNCTION CoUninitialize LIB "OLE32.DLL" () AS LONG
DECLARE FUNCTION StringFromGUID2 LIB "OLE32.DLL" (BYREF rguid AS LongPtr, BYREF lpsz AS WORD, BYVAL cchMax AS LONG) AS LONG

FUNCTION PBMAIN() AS LONG
    PRINT "COM Object Reference via DECLARE:"
    PRINT "- IUnknown::AddRef increments ref count"
    PRINT "- IUnknown::Release decrements ref count"
    PRINT "- OBJECT GET/LET/SET in native PB"
    PRINT "- IS comparison checks interface identity"
    PRINT "Use CoCreateInstance for COM objects"
    FUNCTION = 0
END FUNCTION
