Good call on eliminating the QUIT! I had tried that but forgot to clear the COM obj ref in the command window and of course, the exe was still visible in teh task list so I put the QUIT back in.
Believe it or not, I've done a LOT of COM work in the past. Creating servers for VFP, C++ and VB clients as well as using COM servers from VFP, C++ and VB.
I think this very simple app is telling me to take a vacation, it's been a few years since the last one!
Thanks,
Gary
>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.