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);

}

Software for developers
Delphi Components
.Net Components
Software for Android Developers
More information resources
MegaDetailed.Net
Unix Manual Pages
Delphi Examples
Databases for Amazon shops developers
Amazon Categories Database
Browse Nodes Database