Creates a file moniker for the passed object.

RegisterObjectAsFileMoniker(oObjectReference, cProgID, cFileName)

Parameters

cObjectReference

A reference to the COM object you want to register as a file moniker.

cProgID

The ProgID of your COM object - the same string you used in CREATEOBJECT.

cFileName

The name of a file.

Return Value

A numeric handle representing the registered object.

Remarks

File monikers can be used to identify any object that is stored in its own file. A file moniker acts as a wrapper for the path name the native file system assigns to the file. The source of the object named by the moniker must provide an implementation of the IPersistFile interface to support binding a file moniker. File monikers can represent either a complete or a relative path.

Example

Copy code
LOCAL yourObject, nObjectHandle
yourObject = CREATEOBJECT('some.ComObject')
nObjectHandle= RegisterObjectAsFileMoniker(m.yourObject, 'some.ComObject', 'D:\objec.ref')
? nObjectHandle

&& the object can now be obtained from any program with 
LOCAL loComObjectRef
m.loComObjectRef = GETOBJECT('D:\object.ref')

See Also

Reference

CLSIDFromProgID
CLSIDFromString
CreateGuid
CreateThreadObject
GetIUnknown
IsEqualGuid
ProgIDFromCLSID
RegisterActiveObject
RevokeActiveObject
StringFromCLSID

Used WinApi functions

CLSIDFromProgID
GetRunningObjectTable
StgOpenStorage
StgCreateDocfile
WriteClassStg
ReadClassStg
CreateFileMoniker
IRunningObjectTable Register