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.
>Sergey,
>I have a follow-up question. Your suggestion to check for the COM server works very well, but I was wondering about something.
>
>Initially, before I posted a message here, I was checking for COM server as follows:
>
>
>poGpmPager = createobj("Pager.Send")
>if !type("poGpmPager") = "O" or isnull( poGpmPager )
> =messagebox( "problem" )
>endif
>
>
>But it didn't work and I was getting error on "createobj" line.
>
>I am wondering, why the syntax above does not work but when you add square brackets [] around createbobj, it works?
>
>With addition of your code, now the program creats the object twice: one time to check for COM server registration and another one for actually creating the object. It's not a big deal but I thought that it would be nice to improve the speed by combining both in one. Actually as I type this message I am thinking that maybe I should use brackets [] when creating the object to make it all in one call. I will try it now.
>
>>You're welcome.
>>
>>>Thank you very much for your help, Sergey.
>>>
>>>>Dmitry,
>>>>
>>>>
? TYPE([CREATEOBJECT("mydll.mycomclass")]) = "O"
>>>>
--sb--