>>od=CREATEOBJECT("MSComDlg.CommonDialog.1") >>od.AboutBox() && This works, but... >>od.Flags= 0x00080000 >>od.filename="*.*" >>od.ShowOpen() && ...this causes an OLE error>>However, if I put the OLE control on a form and run the form, the control works the way it's supposed to.
&& Here, G_CanUseCommonDlg is a public var that starts out at zero. && It gets set once in the app as a flag && to indicate that MSComDlg.CommonDialog is available: IF EMPTY(G_CanUseCommonDlg) G_CanUseCommonDlg=1 LOCAL oOleComDlg TRY oOleComDlg=CREATEOBJECT("MSComDlg.CommonDialog.1") CATCH G_CanUseCommonDlg=2 ENDTRY oOleComDlg=.null. ENDIFBy doing this, I know if G_CanUseCommonDlg equals 1, that MSComDlg.CommonDialog.1 is available and my app won't throw an error when I open the form upon which the Control is placed. By the way, I set the form's LEFT property to -500 in the Init so the form itself is not visible. Then in its Activate event, I do the code to set up the OleControl and invoke its ShowOpen() method. This seems to work OK.