General information
Category:
Coding, syntax & commands
This is not a solution to your problem, but:
loObject is declared Local, so it will be released in the end of your function. So, there's no need to test and release the object (it will be released anyway).
Just Return IsNull( loObject) is enough. This will speed up a little.
BTW, the initialization of the object may fail because of the parameters you must or not provide to CreateObject.
Vlad
>I have a visual class library (VCX) with several classes in it. Is there a way to tell if a class exists (not necessarily instatiated) in a class library? This is what I have right now. It works, but it has to instatiate the object to determine whether the class exists. This slows down my application among other things.
>
>LPARAMETERS tcObject
>LOCAL llRetVal
>LOCAL loObject
>
>loObject = CREATEOBJECT(tcObject) && Create object
>llRetVal = (TYPE("loObject.Name") == "C") && True=Class exists
>IF llRetVal && If class exists...
> loObject.Release() && Release object
>ENDIF
>
>RETURN llRetVal
>
>The error event catches and ignores error 1733 (Class definition is not found).
>
>Thanks in advance for any help!
Previous
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only