Page 1 of 1

Posted: Fri Aug 09, 2002 2:02 pm
by BackupUser
Restored from previous forum. Originally posted by Andre.

Does anyone have an overview, how to convert all these API datatypes http://msdn.microsoft.com/library/en-us ... _types.asp to PureBasic variable types ?


Regards
André

*** German PureBasic Support ***

Posted: Fri Aug 09, 2002 3:34 pm
by BackupUser
Restored from previous forum. Originally posted by freak.

OK, here we go...
(I also send that as a file to the RecourceSite.)

Hope it Helps...

Timo

Code: Select all

*****************************************************************
*								*
*	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 Type, 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)
*****************************************************************
  
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
*****************************************************************

VOID 			Means Empty, no Parameter is needed.
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 (they 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.
  
 
*****************************************************************


--
If it stinks, it's chemistry. If it moves, it's biology.
If it does not work, It's computer science.


Edited by - freak on 09 August 2002 16:36:01

Edited by - freak on 09 August 2002 16:43:55

Edited by - freak on 09 August 2002 21:58:27

Posted: Fri Aug 09, 2002 4:18 pm
by BackupUser
Restored from previous forum. Originally posted by Andre.

Wow, what a fast help ! Thanks a lot.

Regards
André

*** German PureBasic Support ***

Posted: Fri Aug 09, 2002 7:15 pm
by BackupUser
Restored from previous forum. Originally posted by Danilo.

Code: Select all

> VOID 			Any Type of Variable
VOID means NOTHING (empty), not any variable type.

See:
HWND GetDesktopWindow(VOID)

in PureBasic:
HWND = GetDesktopWindow_()

cya,
...Danilo

(registered PureBasic user)

Posted: Fri Aug 09, 2002 8:57 pm
by BackupUser
Restored from previous forum. Originally posted by freak.

> VOID means NOTHING (empty), not any variable type.

Are you sure?? Look what the SDK Says: (also at the URL above)

VOID - Any type.

But what you say is true, too. So maybe 'Any type' includes NOTHING?
Anyway, i changed that now, since it's true, that it means Nothing.

Thanks for the hint...

Timo

--
If it stinks, it's chemistry. If it moves, it's biology.
If it does not work, It's computer science.

Posted: Sat Aug 10, 2002 2:07 pm
by BackupUser
Restored from previous forum. Originally posted by fred.

VOID is no parameter. Danilo is right

Fred - AlphaSND

Posted: Sat Aug 10, 2002 2:09 pm
by BackupUser
Restored from previous forum. Originally posted by freak.

I know, and I allready changed that, it's just funny that the SDK says 'Any Type'