RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
ComObj.OleCheck Function

Throws an EOleSysError exception if the result code indicates an error.

Pascal
procedure OleCheck(Result: HResult);
C++
OleCheck(HRESULT Result);

ComObj

OleCheck is used to wrap many COM routines, so that if that routine fails, users will have an opportunity to handle it in the resulting exception that is raised. 

If ECode is a value less than zero, OleCheck raises an EOleSysError exception that specifies the error code.  

Delphi Examples: 

 

{
OleCheck, GuidToString example
The following example manufactures a GUID and displays it in a dialog box after translating it to a string.
} 
uses ActiveX, ComObj;
procedure TForm1.Button1Click(Sender: TObject);
var
  G: TGUID;
begin
  OleCheck(CoCreateGuid(G));
  ShowMessage(SysUtils.GuidToString(G));
end;

 

Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
What do you think about this topic? Send feedback!