I was looking through an application being ported from C to PASCAL (win32 API) and cannot understand, why the type PAINTSTRUCT in C changes to TpaintStruct in PASCAL.
Here are the snippets where it could be seen:
long FAR PASCAL ClientWndProc(HWND hwnd, UINT msg, UINT mp1, LONG mp2)
{
static int cxClient, cyClient;
HBITMAP hbm;
BITMAP bm;
PAINTSTRUCT ps;
...
turns into
function ClientWndProc(hwnd: WinTypes.HWND; msg: Word; mp1: Word; mp2: Longint): Longint; export;
var
hdc: WinTypes.HDC;
hdcMem: WinTypes.HDC;
hbm: WinTypes.HBITMAP;
bm: TBITMAP;
ps: TpaintStruct;
...
I need to port one app myself. Should the same thing apply to TEXTMETRIC type as well? Should I call it TtextMetric in PASCAL?
Delphi (and Turbo Pascal before it, IIRC) has always had the custom of prefixing types with
T, as inTStringList,TButton,TCustomForm,TDateTime, and so forth.You can find
TTextMetric(andTPaintStruct) declared for you already in theWindows.pasunit, along with many of the standard WinAPI functions.(
WinTypesis deprecated, by the way. It’s an old carryover from Delphi 1 for 16 bit apps, and is automatically replaced by Windows in later versions of Delphi.)