Kbase 17329: How to Call WIN32 API Function: DeleteFile
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  10/05/1998 |
|
How to Call WIN32 API Function: DeleteFile
DISCLAIMER:
===========
The code example in this knowledgebase is for informational purposes
only. If you have specific questions about which API calls would be
best suited to your design goals, please consult your Microsoft
documentation.
INTRODUCTION:
=============
The following sample code shows how to call the Win32 API function
called DeleteFile. This function deletes an existing file. If an
application attempts to delete an open file or a file that does not
exist, the function fails.
This code has been tested on Windows NT 4.0 Workstation only.
DEFINE VARIABLE intResult AS INTEGER NO-UNDO.
PROCEDURE DeleteFileA EXTERNAL "KERNEL32.DLL":
DEFINE INPUT PARAMETER chrFileName AS CHARACTER.
DEFINE RETURN PARAMETER intResult AS LONG.
END PROCEDURE.
RUN DeleteFileA ("C:\BRIAN.TXT", OUTPUT intResult).
IF intResult = 1 THEN
MESSAGE "DeleteFile Worked" VIEW-AS ALERT-BOX.
ELSE
MESSAGE "DeleteFile Failed" VIEW-AS ALERT-BOX.
Progress Software Technical Support Note # 17329