Share your advanced PureBasic knowledge/code with the community.
Mistrel
Addict
Posts: 3415 Joined: Sat Jun 30, 2007 8:04 pm
Post
by Mistrel » Sun Jan 06, 2008 6:01 am
Here is a neat thing you can do if you ever get lost in your current directory. :roll:
Code: Select all
Define lpme.MODULEENTRY32
h=CreateToolhelp32Snapshot_($00000008,GetCurrentProcessId_())
lpme\dwSize=SizeOf(MODULEENTRY32)
Module32First_(h,@lpme)
For i=0 To 255
module.s+Chr(lpme\szModule[i])
Next i
For i=0 To 259
path.s+Chr(lpme\szExePath[i])
Next i
Debug module.s
Debug path.s
Fluid Byte
Addict
Posts: 2336 Joined: Fri Jul 21, 2006 4:41 am
Location: Berlin, Germany
Post
by Fluid Byte » Sun Jan 06, 2008 6:41 am
Same result, less code:
Code: Select all
Filename$ = Space(#MAX_PATH)
GetModuleFileName_(0,Filename$,#MAX_PATH)
Debug GetFilePart(Filename$) : Debug Filename$
PB
PureBasic Expert
Posts: 7581 Joined: Fri Apr 25, 2003 5:24 pm
Post
by PB » Sun Jan 06, 2008 7:06 am
And even less code and natively:
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
Mistrel
Addict
Posts: 3415 Joined: Sat Jun 30, 2007 8:04 pm
Post
by Mistrel » Sun Jan 06, 2008 7:36 am
Thanks for the tip, Fluid Byte!
PB wrote: And even less code and natively:
Less code, yes. But this doesn't return the value I need from within a dll.