Skip to Main Content

Oracle Forms

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Using GetFileAttributes from Win32 Api (Forms 6i)

51564Mar 22 2005 — edited Mar 23 2005
Hi,

I have this procedure which checks for file attributes for a given file in forms 6i:

PACKAGE WIN32_API IS
FILE_ATTRIBUTE_ARCHIVE constant pls_integer := 0;
FILE_ATTRIBUTE_COMPRESSED constant pls_integer := 1;
FILE_ATTRIBUTE_DEVICE constant pls_integer := 2;
FILE_ATTRIBUTE_DIRECTORY constant pls_integer := 3;
FILE_ATTRIBUTE_ENCRYPTED constant pls_integer := 4;
FILE_ATTRIBUTE_HIDDEN constant pls_integer := 5;
FILE_ATTRIBUTE_NORMAL constant pls_integer := 6;
FILE_ATTRIBUTE_NOT_CONTENT_IDX constant pls_integer := 7;
FILE_ATTRIBUTE_OFFLINE constant pls_integer := 8;
FILE_ATTRIBUTE_READONLY constant pls_integer := 9;
FILE_ATTRIBUTE_REPARSE_POINT constant pls_integer := 10;
FILE_ATTRIBUTE_SPARSE_FILE constant pls_integer := 11;
FILE_ATTRIBUTE_SYSTEM constant pls_integer := 12;
FILE_ATTRIBUTE_TEMPORARY constant pls_integer := 13;

function GetFileAttributes (lpFileName varchar2)
return pls_integer;

END;


PACKAGE BODY WIN32_API IS
kernel_lhandle Ora_Ffi.Libhandletype;
GetFileAttributes_fhandle Ora_Ffi.Funchandletype;

function ff_GetFileAttributes
(fhandle Ora_Ffi.Funchandletype,
lpFileName varchar2)
return pls_integer;

PRAGMA interface( C, ff_GetFileAttributes, 11265 );


function GetFileAttributes(lpFileName varchar2)
return pls_integer as
begin
return ff_GetFileAttributes( GetFileAttributes_fhandle, lpFileName );
end GetFileAttributes;

BEGIN
/* Load libraries */
kernel_lhandle:=Ora_Ffi.Load_library ( '', 'kernel32.dll' );

/* GetFileAttributes */
GetFileAttributes_fhandle:=Ora_Ffi.Register_Function( kernel_lhandle, 'GetFileAttributesW', Ora_Ffi.C_Std );
Ora_Ffi.Register_Parameter( GetFileAttributes_fhandle, Ora_Ffi.C_CHAR_PTR );
Ora_Ffi.Register_Return ( GetFileAttributes_fhandle, Ora_Ffi.C_INT );
END WIN32_API;




I execute like this:

declare
x pls_integer;
begin
x := WIN32_API.GetFileAttributes('c:\IRAGTPRF.PDF');
message(x); pause;
end;

however, I keep getting -1 as the result from the function. Anybody have any clues? -1 means the function is not executing correctly. I can't figure out where I went wrong.

Thanks in advance,
Al
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 20 2005
Added on Mar 22 2005
2 comments
817 views