DocumentFile, HostName
DocumentFile is a property of OLE bound and unbound controls. It allows you to query or, under limited circumstances, set the linked file. HostName allows you to specify your application's name as you wish it to appear when editing OLE objects.
Usage |
cFileName = oleObject.DocumentFile oleObject.DocumentFile = cFileName cHostName = oleObject.HostName oleObject.HostName = cHostName |
Example |
* Creates a form with a sound player olecontrol * and a close button. Double-click the olecontrol * to play the sounds. * AutoVerbMenu provides a context menu to the control * Right-mouse-click and select 'Edit' to bring up the * Sound Player. Note the File menu has the option * "Exit and Return to <your version of FoxPro>" * and the Sound Player title bar shows the HostName oForm = CREATEOBJECT("frmSound") oForm.Show() READ EVENTS RETURN DEFINE CLASS frmSound AS form ADD OBJECT cmdClose AS CommandButton ADD OBJECT oleSound AS OleControl ; WITH DocumentFile = "C:\WinNT40\Media\Chimes.WAV" Procedure Init WITH This.oleSound .AutoVerbMenu = .T. .HostName = VERSION() * Center the oleControl .Height = 2 * .Height .Top = 0.5 * (ThisForm.Height - .Height) .Left = 0.5 * (ThisForm.Width - .Width) ENDWITH WITH This.cmdClose * Center the Close button on the form bottom .Caption = "Close" .Top = ThisForm.Height - (.Height+5) .Left = 0.5 * (ThisForm.Width - .Width) ENDWITH EndProc Procedure cmdClose.Click CLEAR EVENTS EndProc ENDDEFINE |
See Also |