SET_INTERFACE

Top  Previous  Next

Syntax

SET_INTERFACE object as COMREF, name

Description

Assigns an interface to a COM reference.

Parameters

object - A variable of type COMREF

name - The name as defined in the INTERFACE statement

Return value

None

Remarks

An COM object cannot be used until its interface is set. Once an interface is assigned, and the object initialized with CoCreateInstance or another dedicated function, you can begin using methods in the object.

See Also: INTERFACE, ENDINTERFACE, STDMETHOD, DEFINE_GUID

Example usage

DEF lpTest,lpDD7 as COMREF
DEF freq as UINT
DEF scanline as UINT
lpTest = 0
SET_INTERFACE lpTest, IDirectDraw
SET_INTERFACE lpDD7,IDirectDraw7
DirectDrawCreate(0,lpTest,0)
 
if(lpTest <> 0)
   lpTest->QueryInterface(IID_IDirectDraw7,lpDD7)
   lpTest->GetMonitorFrequency(freq)
   lpTest->GetScanLine(scanline)
   PRINT "Frequency: ",freq
   PRINT "Scanline: ",scanline
   lpTest->Release()
   if lpDD7 <> 0
      lpDD7->Release()
   endif
endif