Thanks folks.
Null3, love your constants sniffer code.
Here is an adapted version I use to generate a list of PB constants and WM_ constants (from windows.res):
Code: Select all
; PB Resident Sniffer
; Main code >> Null3
; Modifications >> syntax error
dr$="d:\purebasic\residents\"
prefix$="PB_"
dq$=Chr(34)
; example line created:
; Debug "#PB_Key_T = $"+Hex(#PB_Key_T)
;
open.s=OpenFileRequester("Res Sniffer",dr$+"*.res","*.res",1)
If ReadFile(0,open)
size.l=Lof()
buffer=AllocateMemory(size)
ReadData(buffer,size)
CloseFile(0)
If CreateFile(1,"const_output.pb")
For a=0 To size
line.s=Trim(PeekS(buffer+a))
If Mid(line,1,3)=prefix$
cont$="#"+line
WriteStringN("Debug "+dq$+cont$+" = $"+dq$+"+Hex("+cont$+")")
EndIf
a+Len(line)
Next
CloseFile(1)
EndIf
EndIf
Example results (copied from the debug list):
Code: Select all
#PB_String_ReadOnly = $800
#PB_String_UpperCase = $8
#PB_Text_Border = $20000
#PB_Text_Center = $1
#PB_Text_Right = $2
#PB_ToolBarIcon_Copy = $1
#PB_ToolBarIcon_Cut = $0
#PB_ToolBarIcon_Delete = $5
#PB_ToolBarIcon_Find = $C
#PB_ToolBarIcon_Help = $B
#PB_ToolBarIcon_New = $6
#PB_ToolBarIcon_Open = $7
...
#WM_GETDLGCODE = $87
#WM_GETFONT = $31
#WM_GETHOTKEY = $33
#WM_GETICON = $7F
#WM_GETMINMAXINFO = $24
#WM_GETTEXT = $D
#WM_GETTEXTLENGTH = $E
#WM_HELP = $53
#WM_HOTKEY = $312
#WM_HSCROLL = $114
#WM_HSCROLLCLIPBOARD = $30E
Executables will be smaller and faster, be sure
Yup. I have a starfield.exe in at 9.7Kb. Nice!