$Obj directive

Purpose

Error checking for OLE-Object types.

Syntax

$ObjNoErr | $ObjectNoErr

$ObjCheck | $ObjectCheck

Description

$ObjNoErr or $ObjectNoErr disables (temporarily) the error checking for OLE object types. Similar to array access, each object access is encapsulated in error checking code and every method call or property access is guarded. This requires some additional code and execution time (the default setting). Without the checking you will save some code (4 bytes) per OLE property or method call and as a result the code will execute faster because no checks are performed.

With $ObjCheck the error checking is re-enabled. See HResult for more information.

Example

$ObjNoErr

OpenW 1

Ocx CommDlg cd

cd.Flags = cdfScreenFonts | cdfShowHelp

cd.ShowFont

cd.Flags = cdcShowHelp

cd.ShowColor

 

Sub cd_OnHelp

Me.Caption = "Help Requested"

EndSub

Remarks

Normally object calls don't return error values; however it is advisbale to still use $ObjNoErr with caution.

See Also

HResult, $AutoPost, $ArrayChk, $For, $Step

{Created by Sjouke Hamstra; Last updated: 17/09/2014 by James Gaite}