***************************************************************** * * * How to use Windows API Types with PureBasic * * * * by Timo Harter, known as Freak * * * ***************************************************************** - Note, that there are a lot of Types in Windows, that can be replaced by the same PB VAlue, mostly LONG. The reason that there are a lot of different Types, is that there are different Types for different jobs, but as you can see, they are all replaced by LONG. - By String, NULL-terminated Strings are meant. - Types are not in alphabetical Order, use a Search Function, to find what you need. - Finally: Feel the _Pure_ Power !! ***************************************************************** Following are Windows Types, and the PB Types, you can use for them (for LONG, see further down) ***************************************************************** VOID Void means no Variable, A Function with VOID as argument has no argument. CONST Constant, any of Type. UNSIGNED Unsigned Attribute (use normal Type, and fill with HEX Values, get Results with StrU() ) BOOL or BOOLEAN #TRUE (1), or #FALSE (0) - can BYTE, WORD and LONG FLOAT FLOAT BYTE BYTE SHORT or WORD WORD USHORT Unsigned SHORT (use WORD, and fill it with HEX Values, for results, use StrU() ) CHAR Character, use BYTE UCHAR Unsigned CHAR (use BYTE, and StrU() or HEX Values) WCHAR 16-bit Unicode character, use WORD TBYTE A WCHAR if UNICODE is defined, a CHAR otherwise. TCHAR A WCHAR if UNICODE is defined, a CHAR otherwise. Following are Windows Types, that can't be used directly from PB ***************************************************************** ATOM ATOM Tables are Sytem-defined String tables, there's no PB-Type for that. REGSAM Security access mask for registry key, not bound to a Type WINAPI Calling convention for system functions, that's no Type CALLBACK Calling convention for callback functions, also no Type CRITICAL_SECTION Critical Section VAriable, don't know of what Type LUID Locally unique identifier. (DOUBLE Value) to be accessed only by Functions, not directly SIZE_T The maximum number of bytes to which a pointer can point. Use for a count that must span the full range of a pointer. SSIZE_T Signed SIZE_T. Following are Windows Types, that can be replaced by LONG type. ***************************************************************** DWORD DWORD32 DWORD_PTR (used for Pointers) INT INT_PTR (Pointers) INT32 LONG LONG_PTR (Pointers) LONG32 COLORREF Color Format (RGB) (LONG with Value $000000 - $FFFFFF) LPARAM Message parameter, use LONG WPARAM Message parameter, use LONG LRESULT Signed result of message processing, use LONG LANGID Language identifier, use LONG LCID Locale identifier, use LONG LCTYPE Locale information type, LONG Following are Windows Types, that could be replaced by UNSIGNED LONG (use LONG, and fill them with HEX Values, for getting results, use StrU() ) ***************************************************************** UINT UINT_PTR (for Pointers) UINT32 ULONG ULONG_PTR (for Pointers) ULONG32 Following are Windows Types, meaning DOUBLE (not supported yet) ***************************************************************** DWORD64 INT64 LONG64 LONGLONG UINT64 (unsigned) ULONG64 (unsigned) ULONGLONG (unsigned) Following are Handles (thay identify Windows, Bitmaps, etc.), they are always LONG ***************************************************************** HACCEL Handle to an accelerator table. HANDLE Handle to an object. HBITMAP Handle to a bitmap. HBRUSH Handle to a brush. HCONV Handle to a dynamic data exchange (DDE) conversation. HCONVLIST Handle to a DDE conversation list. HCURSOR Handle to a cursor. HDC Handle to a device context (DC). HDDEDATA Handle to DDE data. HDESK Handle to a desktop. HDROP Handle to an internal drop structure. HDWP Handle to a deferred window position structure. HENHMETAFILE Handle to an enhanced metafile. HFILE Handle to a file opened by OpenFile, not CreateFile. HFONT Handle to a font. HGDIOBJ Handle to a GDI object. HGLOBAL Handle to a global memory block. HHOOK Handle to a hook. HICON Handle to an icon. HIMAGELIST Handle to an image list. HIMC Handle to input context. HINSTANCE Handle to an instance. HKEY Handle to a registry key. HKL Input locale identifier. HLOCAL Handle to a local memory block. HMENU Handle to a menu. HMETAFILE Handle to a metafile. HMODULE Handle to a module. HMONITOR Handle to a display monitor. HPALETTE Handle to a palette. HPEN Handle to a pen. HRGN Handle to a region. HRSRC Handle to a resource. HSZ Handle to a DDE string. HWINSTA Handle to a window station. HWND Handle to a Window. SC_HANDLE Handle to a service control manager database. SC_LOCK Handle to a service control manager database lock. SERVICE_STATUS_HANDLE Handle to a service status value. Following are Pointers (Memory adresses to Structures/Variables), they are also LONG ***************************************************************** LPBOOL Pointer to a BOOL. LPBYTE Pointer to a BYTE. LPCOLORREF Pointer to a COLORREF value. LPCRITICAL_SECTION Pointer to a CRITICAL_SECTION. LPCSTR Pointer to a constant String. LPCTSTR An LPCWSTR if UNICODE is defined, an LPCSTR otherwise. LPCVOID Pointer to a constant of any type. LPCWSTR Pointer to a constant string of 16-bit Unicode characters. LPDWORD Pointer to a DWORD. LPHANDLE Pointer to a HANDLE. LPINT Pointer to an INT. LPLONG Pointer to a LONG. LPSTR Pointer to a string LPTSTR An LPWSTR if UNICODE is defined, an LPSTR otherwise. LPVOID Pointer to any type. LPWORD Pointer to a WORD. LPWSTR Pointer to a string of 16-bit Unicode characters. PBOOL Pointer to a BOOL. PBOOLEAN Pointer to a BOOL. PBYTE Pointer to a BYTE. PCHAR Pointer to a CHAR. PCRITICAL_SECTION Pointer to a CRITICAL_SECTION. PCSTR Pointer to a string PCTSTR A PCWSTR if UNICODE is defined, a PCSTR otherwise. PCWCH Pointer to a constant WCHAR. PCWSTR Pointer to a constant string of 16-bit Unicode characters. PDWORD Pointer to a DWORD. PFLOAT Pointer to a FLOAT. PHANDLE Pointer to a HANDLE. PHKEY Pointer to an HKEY. PINT Pointer to an INT. PLCID Pointer to an LCID. PLONG Pointer to a LONG. PLUID Pointer to a LUID. POINTER_32 32-bit pointer. POINTER_64 64-bit pointer. On a 64-bit system, this is a native pointer. On a 32-bit system, this is a sign-extended 32-bit pointer. PSHORT Pointer to a SHORT. PSTR Pointer to a string PTBYTE Pointer to a TBYTE. PTCHAR Pointer to a TCHAR. PTSTR A PWSTR if UNICODE is defined, a PSTR otherwise. PUCHAR Pointer to a UCHAR. PUINT Pointer to a UINT. PULONG Pointer to a ULONG. PUSHORT Pointer to a USHORT. PVOID Pointer to any type. PWCHAR Pointer to a WCHAR. PWORD Pointer to a WORD. PWSTR Pointer to a string of 16-bit Unicode characters. *****************************************************************