how do i get the current directory my programs is in?
Posted on 2002-04-30 20:57:18 by Qages
No offense.. but most of your questions are pretty much selfexplanatory... Did you ever consider the Win32.hlp manual ?

Answer btw : GetCurrentDirectory
Posted on 2002-04-30 21:15:19 by JimmyClif
well i need a professinal opionion
Posted on 2002-04-30 21:16:53 by Qages
Posted on 2002-04-30 21:17:17 by JimmyClif
here's one way:

buffer db MAX_PATH dup(?)

invoke GetModuleFileName, NULL, addr buffer, MAX_PATH
Posted on 2002-04-30 22:40:37 by iblis
here's another one ;)

buffer db 256 dup (0)
FileName db "MyFile.exe",0

invoke SearchPath, 0, addr FileName, 0, 256, addr buffer, 0
; not quite sure of the last parameter

..but that's kinda overkill :grin:
Posted on 2002-04-30 23:06:58 by JimmyClif
how do i get the current directory my programs is in

I'm not sure I understand what you mean.
If you need to know current directory your program is working in
than GetCurrentDirectory.
If you need to know directory where is file of your program that is
running than use
GetAppPath from m32lib
here is the code of it:

GetAppPath proc lpPathBuffer:DWORD

invoke GetModuleFileName,0,lpPathBuffer,128 ; return length in eax

mov ecx,lpPathBuffer
lea ecx,[ecx+eax-6] ; add length to ecx - 6

; -----------------------------------------
; read backwards until first "\" character
; -----------------------------------------

mov al,[ecx] ; load byte at address in ECX
dec ecx ; dec ECX
cmp al,'\' ; compare if "\"
jne @B ; jump back to @@: if not "\"

mov byte ptr [ecx+2],0 ; write zero terminator after "\"


GetAppPath endp
Posted on 2002-04-30 23:29:03 by The Svin