
(*
 Delphi Object and Component Reference
# {bmc bm18.BMP} {bmc bm9.BMP} Open, Close, GetAsHandle example
The following code locks the memory for text on the Clipboard, then reads the text.
AnsiString MyString;
int TextHandle;
char *pText;

Clipboard()->Open();
try
{
  TextHandle = Clipboard()->GetAsHandle(CF_TEXT);
  pText = (char *)GlobalLock((HGLOBAL)TextHandle);
  MyString = pText;
  GlobalUnlock((HGLOBAL)TextHandle);
}
catch (...)
{
  Clipboard()->Close();
  throw;
}
Clipboard()->Close(); 
