Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
CreateFile library error
#1
I have been using this code for awhile. It is a CreateFile library function call.
Problem it work in Qb64pe-32 bit but in 64-bit throws a GNU C++ compilation error and I wanted to know why!?

Erik.

Code: (Select All)
Rem $Dynamic
DefLng A-Z
Declare Dynamic Library "kernel32"
    Function CloseHandle& (ByVal hfile As _Offset)
End Declare

Rem hfind = CreateFileA(ASCIIZ, &H180, &H3, 0, 3, 0, 0)
' parameters:
'  (1) pointer to filename
'  (2) access:
'    x80(128)  - read
'    x100(256) - write
'  (3) sharing
'  (4) security attributes
'  (5) create file flag
'  (6) flags (standard OSHA)
'  (7) pointer to template file

' paramater 5
'  0 DEFAULT_OPEN_EXISTING = open only if exists
'  1 CREATE_NEW    = create only if not exist
'  2 CREATE_ALWAYS = always create new file
'  3 OPEN_EXISTING = open only if exists
'  4 OPEN_ALWAYS  = open file always
'  5 TRUNCATE_EXISTING = open/truncate to 0 only if exists
'  6 OPEN_DIRECTORY    = open if directory exists

Declare Library
    Function CreateFileA& (filename$, Byval access&, Byval sharing&, Byval sec_attr%&, Byval create&, Byval flags&, Byval template%&)
End Declare
Dim hfind As _Offset

' detect file
Print "Enter filename";
Input f$
If Len(f$) Then
    f$ = f$ + Chr$(0)
    hfind = CreateFileA(f$, &H180, 0, 0, 3, 0, 0)
    If hfind Then
        Print "File exists."
        r = CloseHandle(hfind)
    End If
End If
End
Reply


Messages In This Thread
CreateFile library error - by eoredson - 06-05-2023, 05:42 AM
RE: CreateFile library error - by DSMan195276 - 06-05-2023, 05:56 AM
RE: CreateFile library error - by eoredson - 06-05-2023, 10:35 PM
RE: CreateFile library error - by DSMan195276 - 06-05-2023, 10:59 PM
RE: CreateFile library error - by eoredson - 06-05-2023, 11:58 PM
RE: CreateFile library error - by DSMan195276 - 06-06-2023, 12:11 AM
RE: CreateFile library error - by mnrvovrfc - 06-06-2023, 12:05 AM
RE: CreateFile library error - by eoredson - 06-06-2023, 01:34 AM
RE: CreateFile library error - by DSMan195276 - 06-06-2023, 03:15 AM
RE: CreateFile library error - by eoredson - 06-06-2023, 02:14 AM
RE: CreateFile library error - by eoredson - 06-06-2023, 03:43 AM
RE: CreateFile library error - by DSMan195276 - 06-06-2023, 04:02 AM
RE: CreateFile library error - by eoredson - 06-06-2023, 04:08 AM
RE: CreateFile library error - by eoredson - 06-06-2023, 04:29 AM
RE: CreateFile library error - by Ultraman - 06-06-2023, 06:06 AM
RE: CreateFile library error - by DSMan195276 - 06-06-2023, 06:23 AM
RE: CreateFile library error - by Ultraman - 06-07-2023, 09:44 PM
RE: CreateFile library error - by DSMan195276 - 06-07-2023, 10:09 PM
RE: CreateFile library error - by eoredson - 06-08-2023, 01:14 AM
RE: CreateFile library error - by eoredson - 06-08-2023, 03:00 AM
RE: CreateFile library error - by SMcNeill - 06-08-2023, 03:29 AM



Users browsing this thread: 43 Guest(s)