How are you compiling this class? As an exe? And why do you need quit there? Just comment this line out.
>Hi Naomi,
>One last imposition on you if I may. The following code always throws an OLE error at the QUIT. Even if I don't call the form that pdfpicker can instantiate. Simply instantiating Viewer and closing the form as:
>
>x=createobject('PDFViewer.Viewer')
>x.loadfiles('123456')
>
>
>and then closing the form throws the error. Any thoughts?
>
>Thanks,
>
>Gary
>
>
>
>DEFINE CLASS Viewer as Custom OLEPUBLIC
>
>PROCEDURE LoadFiles
> LPARAMETERS tcMemberID as String, tcSourceDir as String
>
> LOCAL oForm
>
> SET SAFETY OFF
> _screen.Visible = .F.
>
> oForm = CREATEOBJECT('PDFPicker', tcMemberID, tcSourceDir)
> IF TYPE('oForm') = 'O'
> oForm.Show()
> READ EVENTS
> ENDIF
>
> oForm = NULL
> RELEASE oForm
> *-- TYPE('oForm') = 'U'
>
> IF _vfp.StartMode > 0
> *-- The next line throws the OLE error:
> *-- "OLE iDispatch exception code 0 from ?: ?..."
> QUIT
> ELSE
> _screen.Visible = .T.
> ENDIF
>ENDPROC
>
>ENDDEFINE
>
>
>>>Hi Naomi,
>>>The problem definitely is the object ref going out of scope. I was hoping SHOW() or SHOW(1) would stop it, but it doesn't. Setting a form level property works like a champ. Thanks.
>>>
>>>Gary
>>>
>>>
>>
>>You're welcome. You may need to clear the form's reference (set it to NULL) in form's destroy event.
If it's not broken, fix it until it is.
My Blog