Page 1 of 1

Room for one more?

Posted: Sat May 01, 2004 2:38 pm
by syntax error
Hi PB coders,

Just purchased PureBasic after playing around with the demo.
I love the tiny executables and overall command set.
The visual designer sure helps a lot.

My aim is to convert a tool I've written into a PureBasic version.
:arrow: See sig.

Still lots to learn though.
Expect lots of questions :!:

Posted: Sat May 01, 2004 2:43 pm
by Num3
The search function is your friend!

I recall someone made the necessary freeimage library wrapper for purebasic a while back ;)

Posted: Sat May 01, 2004 3:11 pm
by fweil
Welcome to the licensed users tribe ...

You will certainly find answers and help doing your work easy.

You are welcome to propose pieces of code for helping you to switch to Purebasic.

Executables will be smaller and faster, be sure.

KRgrdes

Posted: Sat May 01, 2004 3:15 pm
by thefool
welcome :D

Posted: Sat May 01, 2004 9:06 pm
by syntax error
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!