Could somehelp help me with an example of using this. I want to copy
files from one directory to another.

Thanks.

BOOL CopyFile(
LPCTSTR lpExistingFileName,
LPCTSTR lpNewFileName,
BOOL bFailIfExists
);

Second question

I want this to show the MessageBox if eax isn't zero
and exit.

AppIsRunning:
pop esi

cmp eax,0 ; if eax isn't zero, don't proceed

invoke MessageBox, NULL,addr MsgBoxText, addr MsgCaption, MB_OK

pop edi
pop ebx
ret
Posted on 2004-11-16 13:13:37 by skywalker
For Copying a single file use the API as follows:



.data
File1 db "C:\autoexec.bat", 0
File2 db "C:\Copy\autoexec.bat", 0

.code
invoke CopyFile, offset File1, offset File2, TRUE


For copying multiple files you have to loop by listing up all available files. You do this by calling FindFirstFile / FindNextFile (example) and on each found file you copy it to it's new location.

For the second question - what about this? ;)


.IF eax != 0
;show msgbox and exit
.ELSE
;keep on as usual
.ENDIF
Posted on 2004-11-16 13:33:38 by JimmyClif
For Copying a single file use the API as follows:


For the second question - what about this? ;)


.IF eax != 0
;show msgbox and exit
.ELSE
;keep on as usual
.ENDIF


The code is working fine but what about those
edi and ebx registers not being popped.




AppIsRunning:
pop esi
; if eax ISN'T zero, Netscape is running
.IF eax != 0
;show msgbox and exit

invoke MessageBox, NULL,addr MsgBoxText, addr MsgCaption, MB_OK
invoke ExitProcess,0

.ELSE
;keep on as usual

.ENDIF

pop edi
pop ebx
ret

TestAppRunning endp
Posted on 2004-11-16 13:49:37 by skywalker

The code is working fine but what about those
edi and ebx registers not being popped.





AppIsRunning:
pop esi
pop edi
pop ebx
.IF eax != 0 ; if eax ISN'T zero, Netscape is running
invoke MessageBox, NULL,addr MsgBoxText, addr MsgCaption, MB_OK
invoke ExitProcess,0
.ENDIF
ret

TestAppRunning endp


You can pop them before doing the compare... esp. if all you do is ret afterwards.
Posted on 2004-11-16 14:21:45 by JimmyClif
I believe you usually don't do things after you call ExitProcess.
Posted on 2004-11-16 14:51:45 by Sephiroth3