1. Deleting files in Win32?

------=_NextPart_000_001A_01BF592E.598C5540
        charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

How can I delete/move a file in Win32 mode without display the DOS =
Window?

Thanks,
Lu=EDs Fernando

------=_NextPart_000_001A_01BF592E.598C5540
        charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content=3D"text/html; charset=3Diso-8859-1" =
http-equiv=3DContent-Type>
<META content=3D"MSHTML 5.00.2614.3500" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>How can I delete/move a file in Win32 =
mode without=20
display the DOS Window?</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Thanks,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Lu=EDs =

------=_NextPart_000_001A_01BF592E.598C5540--

new topic     » topic index » view message » categorize

2. Re: Deleting files in Win32?

I wrote some routines to delete, move, and copy files using the Win32 API,
which you could use. They're in the archive at
http://www.RapidEuphoria.com/win32fil.zip

Jeffrey Fielding
JJProg at cyberbury.net
http://members.tripod.com/~JJProg/

MiCkeY wrote:

> How can I delete/move a file in Win32 mode without display the DOS Window?
>
> Thanks,
> Luís Fernando
>
>   ------------------------------------------------------------------------
>                Name: FILE.HTM
>    FILE.HTM    Type: Hypertext Markup Language (text/html)
>            Encoding: base64

new topic     » goto parent     » topic index » view message » categorize

3. Re: Deleting files in Win32?

On Fri, 7 Jan 2000 16:43:39 -0200, MiCkeY wrote:

>How can I delete/move a file in Win32 mode without display the DOS Window?

If you are using Win32Lib then you can include these functions:

-- start of tested file routines --
include win32lib.ew

constant
  xDeleteFile  = linkFunc(kernel32, "DeleteFileA", {C_POINTER}, C_INT),
  xMoveFile    = linkFunc(kernel32, "MoveFileA", {C_POINTER, C_POINTER},
C_INT)

--------------------------------------------------------------

global procedure deleteFile( sequence fName )
  atom file

  file = allocate_string( fName )
  if not c_func( xDeleteFile, {file} ) then
    warnErr( "xDeleteFile failed in procedure 'deleteFile'" )
  end if
  free( file )
end procedure

--------------------------------------------------------------

global procedure moveFile( sequence existingName, sequence newName )
  atom file1, file2

  file1 = allocate_string( existingName )
  file2 = allocate_string( newName )
  if not c_func( xMoveFile, {file1, file2} ) then
    warnErr( "xMoveFile failed in procedure 'moveFile'" )
  end if
  free( file1 )
  free( file2 )
end procedure
--------------------------------------------------------------

NOTES: the procedure 'moveFile' also works for simply renaming files.  You
may need to do some more error checking as your application sees fit.

If you need more file functions wrapped up (like CreateDirectory, CopyFile,
etc.) just let me know.  Maybe I'll code up a Win32Lib auxiliary
library...

-- Brian

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu