C to Pascal Type Conversion Cheatsheet Useful for when writing a DLL written in one language, while called by a program written in another language. Take note of longint and longbool versus integer and boolean C Type Pascal Type Description ------------------------------------------------------------------------------------- LPSTR PAnsiChar; A string: pointer to char PChar; pchar and pansichar are the same at time of writing LPCSTR PAnsiChar; A string: pointer to char PChar; note: pchar and pansichar are the same at this time DWORD Integer; Whole numbers BOOL LongBool; Boolean values Note: use longbool rather than boolean PBOOL ^BOOL; Pointer to a Boolean value Pbyte ^Byte; Pointer to a byte value PINT ^Integer; Pointer to an integer value Psingle ^Single; Pointer to a single (floating point) value PWORD ^Word; Pointer to a 16-bit value PDWORD ^DWORD; Pointer to a 32-bit value LPDWORD PDWORD; Pointer to a 32-bit value UCHAR Byte; 8-bit values (can represent characters) PUCHAR ^Byte; Pointer to 8-bit values SHORT Smallint; 16-bit whole numbers UINT Integer; 32-bit whole numbers. Traditionally, this was used to represent unsigned integers, but Object Pascal does not have a true unsigned integer data type. PUINT ^UINT; Pointer to 32-bit whole numbers ULONG Longint; 32-bit whole numbers. Traditionally, this was used to represent unsigned integers, but Object Pascal does not have a true unsigned integer data type. PULONG ^ULONG; Pointer to 32-bit whole numbers PLongint ^Longint; Pointer to 32-bit values PInteger ^Integer; Pointer to 32-bit values PSmallInt ^Smallint; Pointer to 16-bit values PDouble ^Double; Pointer to double (floating point) values LCID DWORD; A local identifier LANGID Word; A language identifier THandle Integer; An object handle. Many Windows API functions return a value of type THandle, which identobject ifies that object within Windows’internal object tracking tables. PHandle ^THandle; A pointer to a handle WPARAM Longint; A 32-bit message parameter. Under earlier versions of Windows, this was a 16-bit data type. LPARAM Longint; A 32-bit message parameter LRESULT Longint; A 32-bit function return value HWND Integer; A handle to a window. All windowed controls, child windows, main windows, etc., have a corresponding window handle that identifies them within Windows’internal tracking tables. HHOOK Integer; A handle to an installed Windows system hook ATOM Word; An index into the local or global atom table for a string HGLOBAL THandle; A handle identifying a globally allocated dynamic memory object. Under 32-bit Windows, there is no distinction between globally and locally allocated memory. HLOCAL THandle; A handle identifying a locally allocated dynamic memory object. Under 32-bit Windows, there is no distinction between globally and locally allocated memory. FARPROC Pointer; A pointer to a procedure, usually used as a parameter type in functions that require a callback function HGDIOBJ Integer; A handle to a GDI object. Pens, device contexts, brushes, etc., all have a handle of this type that identifies them within Windows’internal tracking tables. HBITMAP Integer; Handle to Windows bitmap object HBRUSH Integer; Handle to Windows brush object HDC Integer; Handle to device context HENHMETAFILE Integer; Handle to Windows enhanced metafile object HFONT Integer; Handle to Windows logical font object HICON Integer; Handle to Windows icon object HMENU Integer; Handle to Windows menu object HMETAFILE Integer; Handle to Windows metafile object HINST Integer; Handle to instance object HMODULE HINST; Handle to module HPALETTE Integer; Handle to Windows color palette HPEN Integer; Handle to Windows pen object HRGN Integer; Handle to Windows region object HRSRC Integer; Handle to Windows resource object HKL Integer; Handle to keyboard layout HFILE Integer; Handle to open file HCURSOR HICON; Handle to Windows mouse cursor object COLORREF DWORD; A Windows color reference value, containing values for the red, green, and of ;bsp;blue components of a color