Microsoft KB Archive/163025

= PRB: OLE Error when Inserting OLE Object in VFP for Macintosh =

Article ID: 163025

Article Last Modified on 2/5/2000

-

APPLIES TO


 * Microsoft Visual FoxPro 3.0b for Macintosh

-



This article was previously published under Q163025



SYMPTOMS
When inserting an OLE object into a general field, adding an insertable OLE object in a container control on a form, or assigning an object name to the DocumentFile property of an OLE container control in program code, the following error message may appear:

OLE error code 0x80000008: Unspecified error.



CAUSE
The object inserted into the general field, or added as an insertable object in an OLE container on a form, or assigned to the DocumentFile property, has File and Creator types that are not associated with an application on the Macintosh.



RESOLUTION
There are several workarounds to this error:


 * Open the file/graphic in an existing application on the Macintosh, then copy and paste the text/graphic into the general field.
 * Use a resource editor such as Apple's ResEdit to change the File and Creator type to the types required by the application server.
 * Use the Foxtools.cfm function FxSetType to set the File and Creator type of the file to types associated with an application installed on the Macintosh.

For more information on using the FxSetType function with an Imager File, please see the following articles in the Microsoft Knowledge Base:

152370 How To Use the APPEND GENERAL Command with an Imager File

109482 How To Change the Creator and Type Set by FCREATE



STATUS
This behavior is by design.



MORE INFORMATION
On the Macintosh, all files are associated to an application by either the File or Creator type. A file's Creator and Type attributes identify the parent application of a file and its specific kind. The Type attribute is used by other applications in order to determine whether a file is a valid document to load. Whereas in Windows, files are generally associated to applications by their file extension.

Steps to Reproduce Behavior
This error message can be produced in the following three methods.

Method 1:

Attempt to assign a file to the DocumentFile property in code when creating an OLE object using the CREATEOBJECT function.

NOTE: By default, the "Picts folder" and the graphics do not exist. Visual FoxPro ships with sample graphics files that are contained in a self- extracting archive (SEA) file located in the "Microsoft Visual FoxPro:Samples:Graphics" folder. To follow the steps below, double-click the Picts.sea to extract the PICT files. Store them in the default folder specified "Picts Folder." For more information of these SEA files, read the Graphics Readme in the above folder. * The file and creator types used below are specific to Microsoft Imager * Uncomment the next three lines of code to prevent OLE error * mypict= HOME+"Samples:Graphics:Picts Folder:Fox:Add.PICT" * SET LIBRARY TO HOME + "Foxtools.cfm" ADDITIVE * =FxSetType(SYS(2027,mypict ),"PICT","MIMG")

frmMyForm = CREATEOBJECT('form') && Create a form frmMyForm.Closable = .F. && Disable the close box frmMyForm.AddObject('cmdCommand1','cmdMyCmdBtn') && Add Command button frmMyForm.AddObject("oleObject","oleImager")     && Add OLE object frmMyForm.cmdCommand1.Visible=.T.  && Display the "Quit" Command button frmMyForm.oleObject.Visible=.T.    && Display the OLE control frmMyForm.oleObject.Height = 50    && OLE control height frmMyForm.oleObject.AutoActivate = 2 frmMyForm.Show && Display the form frmMyForm.oleObject.DoVerb(0)      && 0 for Default, -1 for Edit

READ EVENTS && Start event processing CLEAR CLASS oleImager

DEFINE CLASS oleImager as OLEControl OleClass ="MSImager.2" && Server name * Uncomment next line, comment 2nd DocumentFile to prevent error * DocumentFile = mypict DocumentFile = HOME+"Samples:Graphics:Picts Folder:Fox:Add.PICT" ENDDEFINE

DEFINE CLASS cmdMyCmdBtn AS CommandButton && Create Command button Caption = '\ Create a new form. From the Form Controls toolbar, select the OLE Container Control button and click somewhere on the form. In the Object Type dialog box, choose Microsoft Imager 2.0 Picture. Then choose the 'From File' option button under the Create label.  Then select Add.PICT from the following folder:      MACINTOSH HD:VFP:Samples:Graphics:Picts Folder:Fox </ol>

Method 3:

Directly insert the OLE object into the general field of the table.

<ol> Create a table with a general field.</li> Browse the table and double-click on the general field to open the general field window.</li> Choose the Insert Object command on the Edit menu.</li> In the Object Type dialog box, choose Microsoft Imager 2.0 Picture. Then choose the 'From File' option button under the Create label.</li>  Then select Add.PICT from the following folder: <pre class="fixed_text">     MACINTOSH HD:VFP:Samples:Graphics:Picts Folder:Fox </li></ol>

The task in Method 3 can also be accomplished by using the APPEND GENERAL command. For more information on using the APPEND GENERAL command with OLE objects, please see the following articles in the Microsoft Knowledge Base:

152370 How To Use the APPEND GENERAL Command with an Imager File

137295 How To Convert Memo Fields into Embedded Word Documents

NOTE: If error messages are received regarding problems with OLE functionality, please refer to the following articles in the Microsoft Knowledge Base:

151636 Insert Object of an Imager File Causes Error or Hangs Mac

141099 MXL5 Err Msg: "Cannot Start the Source Application"

(c) Microsoft Corporation 1997, All Rights Reserved.

Contributions by Dean Christopher, Microsoft Corporation

Keywords: KB163025

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.