WinApi Variable type tool for the IDE
Posted: Sat Jan 11, 2014 7:36 pm
Hi to all A small IDE tool ( i made for my personal use ) to help with win api variable types to pb variable type conversion. Some of the variable pbtype may not correct
and not all types may have been included
149 msdn types included.
Please correct and or add to variable definitions data taken for forum(kale and freak
) and mdsn
Updated: 21:45 --- Auto resize window/gadget depending on the length of the msg string.
Updated: added stickywindow() --- just to keep on top
Place ide cursor on the variable of interest and (for me right handed) press lctrl+q and small window pops up under the mouse cursor with pbtype to use auto closes after 3 secs (ajust addwindowtimer() for more/less)

IDE tool set up

zebuddi.


149 msdn types included.
Please correct and or add to variable definitions data taken for forum(kale and freak


Updated: 21:45 --- Auto resize window/gadget depending on the length of the msg string.
Updated: added stickywindow() --- just to keep on top
Place ide cursor on the variable of interest and (for me right handed) press lctrl+q and small window pops up under the mouse cursor with pbtype to use auto closes after 3 secs (ajust addwindowtimer() for more/less)

IDE tool set up

zebuddi.

Code: Select all
;
Global Window_0 , Window_0_Text_0
Global msg.s , pbtype.s , Text.s , Cursor.POINT , Text.s
Define ScintillaID.i = Val( GetEnvironmentVariable( "PB_TOOL_Scintilla" ) ) , Event.l
Procedure.s GetPBType( Ctype.s )
Select Ctype.s
Case "ATOM"
pbtype.s = "No PB Type --- ATOM Tables are Sytem-defined String Tables , there's no PB-Type for that."
Case "BOOL"
pbtype.s = "BYTE or WORD or LONG --- #TRUE( 1 ) , Or #False( 0 ) - can be BYTE , WORD And LONG"
Case "BOOLEAN"
pbtype.s = "BYTE or WORD or LONG --- #TRUE( 1 ) , Or #FALSE( 0 ) - can be BYTE , WORD And LONG"
Case "BYTE"
pbtype.s = "BYTE --- A byte( 8 bits ) "
Case "CALLBACK"
pbtype.s = "Calling convention For CALLBACK functions , also no Type"
Case "CCHAR"
pbtype.s = "BYTE --- An 8-bit Windows( ANSI ) character."
Case "CHAR"
pbtype.s = "BYTE --- Character , use BYTE"
Case "COLORREF"
pbtype.s = "LONG --- Color Format( RGB ) ( LONG With Value $000000 - $FFFFFF ) "
Case "CONSTANT"
pbtype.s = "# + Variable_Name --- Constant , any of Type."
Case "CRITICAL_SECTION"
pbtype.s = "Critical Section Variable , don't know of what Type"
Case "DOUBLE"
pbtype.s = "DOUBLE"
Case "DWORD"
pbtype.s = "LONG --- A 32-bit unsigned integer. The range is 0 through 4294967295 decimal"
Case "DWORD32"
pbtype.s = "LONG A 32 bit unsigned integer"
Case "DWORDLONG"
pbtype.s = "INTEGER --- A 64-bit unsigned integer. The range is 0 through 18446744073709551615 decimal"
Case "DWORD64"
pbtype.s = "QUAD --- A 64-bit unsigned integer. The range is 0 through 18446744073709551615 decimal."
Case "DWORD_PTR"
pbtype.s = "LONG ---( Used For Pointers ) "
Case "FLOAT"
pbtype.s = "FLOAT --- A floating-point variable"
Case "HACCEL"
pbtype.s = "INTEGER --- Handle To an accelerator table."
Case "HANDLE"
pbtype.s = "INTEGER --- Handle To an object."
Case "HBITMAP"
pbtype.s = "INTEGER --- Handle To a bitmap."
Case "HBRUSH"
pbtype.s = "INTEGER --- Handle To a brush."
Case "HCOLORSPACE"
pbtype.s = "INTEGER --- A handle to a color space"
Case "HCONV"
pbtype.s = "INTEGER --- Handle To a dynamic Data exchange( DDE ) conversation."
Case "HCONVLIST"
pbtype.s = "INTEGER --- Handle To a DDE conversation list."
Case "HCURSOR"
pbtype.s = "INTEGER --- Handle To a cursor."
Case "HDC"
pbtype.s = "INTEGER --- Handle To a cursor."
Case "HDDEDATA"
pbtype.s = "INTEGER --- Handle To DDE Data."
Case "HDESK"
pbtype.s = "INTEGER --- Handle To a desktop."
Case "HDROP"
pbtype.s = "INTEGER --- Handle To an Internal drop Structure."
Case "HDWP"
pbtype.s = "INTEGER --- Handle To a deferred window Position Structure."
Case "HENHMETAFILE"
pbtype.s = "INTEGER --- Handle To an enhanced metafile."
Case "HFILE"
pbtype.s = "INTEGER --- A handle To a file opened by OpenFile , Not CreateFile."
Case "HFONT"
pbtype.s = "INTEGER --- A handle to a font"
Case "HGDIOBJ"
pbtype.s = "INTEGER --- A handle to a GDI object"
Case "HGLOBAL"
pbtype.s = "INTEGER --- A handle to a global memory block"
Case "HHOOK"
pbtype.s = "INTEGER --- A handle to a hook"
Case "HICON"
pbtype.s = "INTEGER --- A handle to an icon"
Case "HIMAGELIST"
pbtype.s = "INTEGER --- A handle to an imagelist"
Case "HIMC"
pbtype.s = "INTEGER --- A handle to an compostion message"
Case "HINSTANCE"
pbtype.s = "INTEGER --- A handle to an instance"
Case "HKEY"
pbtype.s = "INTEGER --- A handle to a registry key"
Case "HKL"
pbtype.s = "INTEGER --- An input locale identifier"
Case "HLOCAL"
pbtype.s = "INTEGER --- A handle to a local memory block"
Case "HMENU"
pbtype.s = "INTEGER --- A handle to a menu"
Case "HMETAFILE"
pbtype.s = "INTEGER --- A handle to a metafile"
Case "HMODULE"
pbtype.s = "INTEGER --- A handle to a module. "
Case "HMONITOR"
pbtype.s = "INTEGER --- A handle to a display monitor"
Case "HPALLETTE"
pbtype.s = "INTEGER --- A handle to a pallette"
Case "HPEN"
pbtype.s = "INTEGER --- A handle to a pen"
Case "HRGN"
pbtype.s = "INTEGER --- A handle to a region"
Case "HRSRC"
pbtype.s = "INTEGER --- A handle to a resource"
Case "HSZ"
pbtype.s = "INTEGER --- A handle to a DDE string."
Case "HWINSTA"
pbtype.s = "INTEGER --- A handle to a window station"
Case "HWND"
pbtype.s = "INTEGER --- A handle to a window"
Case "INT"
pbtype.s = "LONG --- A 32-bit signed integer. The range is -2147483648 through 2147483647 decimal"
Case "INT32"
pbtype.s = "LONG --- A 32-bit signed integer. The range is -2147483648 through 2147483647 decimal"
Case "INT64"
pbtype.s = "QUAD --- A 64-bit (8-byte) integer"
Case "INT_PTR"
pbtype.s = "LONG --- Pointer --- A 32-bit signed integer. The range is -2147483648 through 2147483647 decimal"
Case "LANGID"
pbtype.s = "LONG --- Language identifier"
Case "LCID"
pbtype.s = "LONG --- Locale identifier"
Case "LCTYPE"
pbtype.s = "LONG --- Locale information Type , LONG"
Case "LGRPID"
pbtype.s = "LONG --- A language group identifier. For a list , see EnumLanguageGroupLocales."
Case "LONG"
pbtype.s = "LONG --- A 32-bit signed integer. The range is 2147483648 through 2147483647 decimal.."
Case "LONGLONG"
pbtype.s = "QUAD --- A 64-bit signed integer. The range is 9223372036854775808 through 9223372036854775807 decimal"
Case "LONG32"
pbtype.s = "LONG --- A LONG32 is a 32-bit signed integer."
Case "LONG64"
pbtype.s = "QUAD --- A LONG64 is a 64-bit signed integer."
Case "LPARAM"
pbtype.s = "LONG --- message parameter"
Case "LPBOOL"
pbtype.s = "LONG --- A pointer to a BOOL"
Case "LPBYTE"
pbtype.s = "LONG --- A pointer to a BYTE"
Case "LPCOLORREF"
pbtype.s = "LONG --- A pointer to a COLORREF value"
Case "LPCRITICAL_SECTION"
pbtype.s = "LONG --- A pointer to the critical section object."
Case "LPCSTR"
pbtype.s = "LONG --- A pointer to a constant null-terminated string of 8-bit Windows( ANSI ) characters"
Case "LPCTSTR"
pbtype.s = "LONG --- An LPCWSTR if UNICODE is defined , an LPCSTR otherwise."
Case "LPCVOID"
pbtype.s = "LONG --- A pointer to a constant of any type"
Case "LPCWSTR"
pbtype.s = "LONG --- A pointer to a constant null-terminated string of 16-bit Unicode characters"
Case "LPDWORD"
pbtype.s = "LONG --- A pointer to a DWORD"
Case "LPFINDREPLACE"
pbtype.s = "LONG --- A pointer To a findreplace Structure"
Case "LPHANDLE"
pbtype.s = "LONG --- A pointer to a HANDLE"
Case "LPINT"
pbtype.s = "LONG --- A pointer to an INT"
Case "LPLONG"
pbtype.s = "LONG --- A pointer to a LONG"
Case "LPSTR"
pbtype.s = "LONG --- A pointer to a null-terminated string of 8-bit Windows( ANSI ) characters."
Case "LPTSTR"
pbtype.s = "LONG --- An LPWSTR if UNICODE is defined , an LPSTR otherwise."
Case "LPVOID"
pbtype.s = "LONG --- A pointer to any type"
Case "LPWORD"
pbtype.s = "LONG --- A pointer to a WORD"
Case "LPWSTR"
pbtype.s = "LONG --- A pointer to a null-terminated string of 16-bit Unicode characters. "
Case "LRESULT"
pbtype.s = "LONG --- Signed result of message processing"
Case "LONG_PTR"
pbtype.s = "LONG --- A 32-bit signed integer. The range is -2147483648 through 2147483647 decimal"
Case "LUID"
pbtype.s = "Locally unique identifier.( DOUBLE Value ) To be accessed only by functions , Not directly"
Case "PBOOL"
pbtype.s = "LONG --- A pointer to a BOOL"
Case "PBOOLEAN"
pbtype.s = "LONG --- A pointer to a BOOLEAN."
Case "PBYTE"
pbtype.s = "LONG --- A pointer to a BYTE"
Case "PCHAR"
pbtype.s = "LONG --- A pointer to a CHAR."
Case "PCRITICAL_SECTION"
pbtype.s = "LONG --- A pointer to a CHAR."
Case "PCSTR"
pbtype.s = "LONG --- A pointer to a constant null-terminated string of 8-bit Windows( ANSI ) characters. "
Case "PCTSTR"
pbtype.s = "LONG --- A pointer to a constant null-terminated string of 8-bit Windows( ANSI ) characters."
Case "PCWCH"
pbtype.s = "LONG --- A pointer to a constant null-terminated string of 8-bit Windows( ANSI ) characters"
Case "PCWSTR"
pbtype.s = "LONG --- A pointer to a constant null-terminated string of 16-bit Unicode characters."
Case "PDWORD"
pbtype.s = "LONG --- A pointer to a DWORD"
Case "PDWORDLONG"
pbtype.s = "LONG --- A pointer to a DWORDLONG."
Case "PFLOAT"
pbtype.s = "LONG --- A pointer to a FLOAT"
Case "PHANDLE"
pbtype.s = "LONG --- A pointer to a HANDLE."
Case "PHKEY"
pbtype.s = "LONG --- A pointer to an HKEY"
Case "PINT"
pbtype.s = "LONG --- A pointer to an INT"
Case "PLCID"
pbtype.s = "LONG --- A pointer to an LCID."
Case "PLONG"
pbtype.s = "LONG --- A pointer to a LONG."
Case "PLUID"
pbtype.s = "LONG --- A pointer to a LONG."
Case "POINTER_32"
pbtype.s = "LONG --- A pointer to a LONG."
Case "POINTER_64"
pbtype.s = "QUAD --- A pointer to a LONG."
Case "PLONGLONG"
pbtype.s = "LONG --- A pointer to a LONGLONG"
Case "PSHORT"
pbtype.s = "LONG --- A pointer to a SHORT."
Case "PSTR"
pbtype.s = "LONG --- A pointer to a null-terminated string of 8-bit Windows( ANSI ) characters"
Case "PTBYTE"
pbtype.s = "LONG --- A pointer to a TBYTE."
Case "PTCHAR"
pbtype.s = "LONG --- A pointer to a TCHAR."
Case "PTSTR"
pbtype.s = "LONG --- A PWSTR if UNICODE is defined , a PSTR otherwise."
Case "PUCHAR"
pbtype.s = "LONG --- A pointer to a UCHAR"
Case "PUINT"
pbtype.s = "LONG --- A pointer to a UINT"
Case "PULONG"
pbtype.s = "LONG --- A pointer to a ULONG"
Case "PULONGLONG"
pbtype.s = "LONG --- A pointer to a ULONGLONG"
Case "PUSHORT"
pbtype.s = "LONG --- A pointer to a USHORT"
Case "PVOID"
pbtype.s = "LONG --- A pointer to any type."
Case "PWCHAR"
pbtype.s = "LONG --- A pointer to a WCHAR"
Case "PWORD"
pbtype.s = "LONG --- A pointer to a WORD"
Case "PWSTR"
pbtype.s = "LONG --- A pointer to a null-terminated string of 16-bit Unicode characters. "
Case "QWORD"
pbtype.s = " --- A 64-bit unsigned integer."
Case "SHORT"
pbtype.s = "WORD --- A 16-bit integer. The range is 32768 through 32767 decimal."
Case "SC_HANDLE"
pbtype.s = "LONG --- A 16-bit integer. The range is 32768 through 32767 decimal."
Case "SC_LOCK"
pbtype.s = "LONG --- A 16-bit integer. The range is 32768 through 32767 decimal."
Case "SERVICE_STATUS_HANDLE"
pbtype.s = "LONG --- A 16-bit integer. The range is 32768 through 32767 decimal."
Case "SIZE_T"
pbtype.s = "the maximum number of Bytes To which a pointer can point. "
Case "SSIZE_T"
pbtype.s = "signed SIZE_T --- the maximum number of Bytes To which a pointer can point. "
Case "REGSAM"
pbtype.s = "Security access mask For registry key , Not bound To a Type"
Case "TBYTE"
pbtype.s = "CHARACTER --- a WCHAR If Unicode is defined , a Char otherwise."
Case "TCHAR"
pbtype.s = "CHARACTER --- a WCHAR If Unicode is defined , a Char otherwise."
Case "UCHAR"
pbtype.s = "BYTE --- UNSIGNED CHAR( use BYTE , And StrU( ) Or HEX Values ) "
Case "UINT"
pbtype.s = "LONG --- An unsigned INT. The range is 0 through 4294967295 decimal"
Case "UINT64"
pbtype.s = "QUAD --- An unsigned INT. The range is 0 through 4294967295 decimal"
Case "ULONG"
pbtype.s = "LONG --- An unsigned LONG. The range is 0 through 4294967295 decimal"
Case "ULONGLONG"
pbtype.s = "QUAD --- A 64-bit unsigned integer. The range is 0 through 18446744073709551615 decimal."
Case "ULONG32"
pbtype.s = "LONG --- A 64-bit unsigned integer. The range is 0 through 18446744073709551615 decimal"
Case "ULONG64"
pbtype.s = "QUAD --- A 64-bit unsigned integer. The range is 0 through 18446744073709551615 decimal."
Case "USHORT"
pbtype.s = "WORD --- UNSIGNED SHORT( use WORD , And fill it With HEX Values , For Results , use StrU( ) ) "
Case "USN"
pbtype.s = "INTEGER --- An update sequence number( USN ) ."
Case "UINT_PTR"
pbtype.s = "POINTER --- An update sequence number( USN ) ."
Case "ULONG_PTR"
pbtype.s = "POINTER --- An update sequence number( USN ) "
Case "UNSIGNED"
pbtype.s = "UNSIGNED --- Attribute( use normal Type , And fill With HEX Values , get Results With StrU( ) ) "
Case "VOID"
pbtype.s = " VOID --- means no Variable , a Function With VOID As argument has no argument."
Case "WCHAR"
pbtype.s = "WORD --- 16-bit Unicode Character , use WORD"
Case "INTEGER"
pbtype.s = "INTEGER --- A 16-bit unsigned integer. The range is 0 through 65535 decimal"
Case "WINAPI"
pbtype.s = "Calling convention For system functions , no type"
Case "WORD"
pbtype.s = "Word --- A 16-bit unsigned integer."
Case "WPARAM"
pbtype.s = "LONG --- message parameter"
Default
pbtype.s = "Not In The List"
EndSelect
ProcedureReturn pbtype
EndProcedure
Procedure.s IDE_GetWord( ScintillaID.l )
Protected cpos.l , Min.l , Max.l , Position.l
Position = SendMessage_( ScintillaID , #SCI_GETCURRENTPOS , #Null , #Null )
cpos = Position
Min = SendMessage_( ScintillaID , #SCI_WORDSTARTPOSITION , Position , #True )
Max = SendMessage_( ScintillaID , #SCI_WORDENDPOSITION , Position , #True )
For Position = Min To Max-1
Text + Chr( SendMessage_( ScintillaID , #SCI_GETCHARAT , Position , #Null ) )
Next
ProcedureReturn Text
EndProcedure
Procedure OpenWindow_Window_0( )
Window_0 = OpenWindow( #PB_Any , Cursor\x , Cursor\y + 10 , 550 , 20 , "" , #PB_Window_BorderLess )
If Window_0
If LoadFont( 1 , "Arial" , 12 )
SetGadgetFont( #PB_Default , FontID( 1 ) )
EndIf
Window_0_Text_0 = TextGadget( #PB_Any , 0 , 0 , 550 , 20 , "( " + Text + " ) " + msg , #PB_Text_Center )
SetGadgetColor( Window_0_Text_0 , #PB_Gadget_BackColor , RGB( 193 , 169 , 229 ) )
EndIf
EndProcedure
Procedure.i StringLength2GadgetWidth( Gid.i )
DC = GetDC_( GadgetID( Window_0_Text_0 ) )
msg = RemoveString( msg , Chr( 10 ) + Chr( 13 ) )
GetTextExtentPoint32_( DC , @msg , Len( msg ) , @LineSize.SIZE )
LineSize\cx + 50
ProcedureReturn LineSize\cx
EndProcedure
CallDebugger
msg.s = GetPBType( UCase( IDE_GetWord( ScintillaID ) ) )
GetCursorPos_( Cursor.POINT )
OpenWindow_Window_0( )
HideWindow( Window_0 , #True )
width.i = StringLength2GadgetWidth( Window_0_Text_0 )
SetGadgetText( Window_0_Text_0 , msg )
ResizeWindow( Window_0 , #PB_Ignore , #PB_Ignore , width , #PB_Ignore )
ResizeGadget( Window_0_Text_0 , #PB_Ignore , #PB_Ignore , width , #PB_Ignore )
HideWindow( Window_0 , #False )
StickyWindow( Window_0 , 1 )
AddWindowTimer( Window_0 , 1 , 4000 ) ; leave on screen 4 secs
Repeat
Event = WaitWindowEvent( )
If Event = #PB_Event_Timer
CloseWindow( Window_0 )
Window_0 = 0
Break
EndIf
Until Event = #PB_Event_CloseWindow