Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Checking for COM server ?
Message
From
11/06/2003 10:34:48
 
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Miscellaneous
Thread ID:
00798846
Message ID:
00798927
Views:
30
Dmitry,

As Sergey was saying, you can still trap for the error in previous versions, and only create the object once:
local llError, lcOldError
lcOldError = on("error")
on error llError = .T.
poGpmPager = createobject("Pager.Send")
on error &lcOldError
if llError
    MessageBox("Couldn't create object")
    return -1  && return an error code
endif

* do your stuff with the object
>Thank you for the explanation, Sergey. One more reason to move up to VFP 8. Which I plan to do, anyway.
>
>>Dmitry,
>>
>>The brackets are needed because TYPE() function evaluates it's argument and the error isn't generated because TYPE() function intercepts it and returns "U". It would be quite easy to do in VFP8.
TRY
>>  poGpmPager = createobj("Pager.Send")
>>CATCH
>>  =messagebox( "problem" )
>>ENDTRY
In previous version you'll have to use local error handler to do the same.
>>
Steve Gibson
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform