Vista, Windows 7 and even 64-bit OS (inc. XP)

Blitz3D Forums/Blitz3D Beginners Area/Vista, Windows 7 and even 64-bit OS (inc. XP)

_PJ_(Posted 2010) [#1]
Please could you test this, and even if possibole, add insight if you know more about the issue:

http://www.blitzbasic.com/codearcs/codearcs.php?code=2676


Kev(Posted 2010) [#2]
use the windows api MoveFile() it can be used to rename files also, requres two LPCTSTR param set them up as banks and pass them. MoveFile can be found in Kernel32.dll

kev


_PJ_(Posted 2010) [#3]
Thanks, Kev I wanted to try and do something quick without invoking dll's though.
Still, setting up banks means that CallDll will work rather than needing to add decls. :)


xlsior(Posted 2010) [#4]
Invoking a system DLL that is MADE to perform the job would be vastly preferable to trying to mickey-mouse something through an external command prompt, in my book... I mean, you're already seeing compatibility issues with the command prompt here.

Even if you get them squared away now, there's still a good chance that it will break again when Windows 8 comes around, and windows 9, and...

Using the proper Windows API instead greatly increases the chances that your programs continue to function properly in the long run.


_PJ_(Posted 2010) [#5]
I see the sense in that ;)

I tried to write a decls to utilise the Windows api function, but I can't get it to work. I'm no good at this kinda stuff, so I'm not even sure where I'm going wrong...

Here's what I have so far:

.Lib "Kernel32.dll"
Api_CopyFile%(lpExistingFileName$,lpNewFileName$,bFailIfExists%) : "CopyFile"


But I receive a "User lib function not found" error when I tery to use it:

Api_CopyFile%("C:\Program Files\Blitz3D\Bin\test.txt","test2.txt",1)



Charrua(Posted 2010) [#6]
hi
the correct sintax in the decls is:

api_CopyFile% (lpExistingFileName$, lpNewFileName$, bFailIfExists%) : "CopyFileA"

(pay attention at the end: "CopyFileA")

Juan


_PJ_(Posted 2010) [#7]
Thanks, Charrua that works fine :)

I was close ;)


Charrua(Posted 2010) [#8]
very,

many headaches wiht missmatching decls, when to include an asterisk?, when not?, when the "$"?, some times, (many) this is the only distance from a working code and a MAV.

Juan