There are two HEAVILY used macro's (functions) in C++ ... used for testing the return values from COM calls ... one is called SUCCEEDED(hresult) and the other is FAILED(hresult) ... they return TRUE or FALSE depending. SUCCEEDED will return TRUE on successes and informationals ... FAILED will return TRUE on errors and warnings. Loosely translated, they would look like this:

Code:

Function SUCCEEDED($hr)

$SUCCEEDED = $hr >= 0

EndFunction

Function FAILED($hr)

$FAILED = $hr < 0

EndFunction



The code for checking a successfull CreateObject would look like this:

Code:

$xml = CreateObject("microsoft.xmldom")

If FAILED(@ERROR)
?"Failed..."
Endif