|
CreateCompatibleHRC
The CreateCompatibleHRC function allocates memory for the HRC object. The example below calls the Windows function GlobalAlloc and uses the returned memory handle as the HRC. Locking the allocated memory with GlobalLock provides a far pointer to the allocated HRCinternal structure.
When an input session begins, the pen state is always down. Therefore, the
function initializes the wPdk member to PDK_DOWN.
HRC WINAPI CreateCompatibleHRC( HRC hrcTemplate, HREC hrec )
{
HGLOBAL hglobal; // Handle of allocated HRC object
LPHRCinternal lphrc; // Far pointer to object
.
.
.
// Allocate memory for HRC and get far pointer to it
hglobal = GlobalAlloc( GHND, sizeof( HRCinternal ) );
lphrc = (LPHRCinternal) GlobalLock( hglobal );
// If failure, return NULL
if (!lphrc)
return NULL;
// Save HRC memory handle, because DestroyHRC will need it
lphrc->hglobal = hglobal;
// If template provided, copy its information to the new HRC
if (hrcTemplate)
NCopyTemplateInfo( hrcTemplate, lphrc );
// Initialize other information
lphrc->hpendata = CreatePenData( NULL, 0, PDTS_HIENGLISH, 0 );
lphrc->wPdk = PDK_DOWN;
.
.
.
// If no errors, return pointer as HRC handle
return ((HRC) lphrc);
}
Related Links
Software for Delphi and C++ Builder developers
Software for Visual Studio .NET developers
Software for Visual Basic 6 developers
Delphi Tips&Tricks
MegaDetailed.NET
TMS Scripter Studio Pro components for Delphi/C++Builder
More Online Helps
Win32 Programmer's Reference (win32.hlp)
Win32 Multimedia Programmer's Reference (mmedia.hlp)
OLE Programmer's Reference (ole.hlp)
Microsoft Windows Sockets 2 Reference (sock2.hlp)
Microsoft Windows Telephony API (TAPI) Programmer's Reference (tapi.hlp)
Unix Manual Pages
|