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

Thank you very much for the suggestion and sample code.

>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.
>>>
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Previous
Reply
Map
View

Click here to load this message in the networking platform