Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
CreateFile library error
#12
(06-06-2023, 03:43 AM)eoredson Wrote: That's even more confusing. I am also using _unsigned long for functions concerning attribute returns.

Do I have to modify them as well?
You simply need to read the Microsoft documentation and understand the C++ types used. See the CreateFileA description. `DWORD` is a 32-bit integer, which in QB64 is a `LONG`. `LPCSTR` is a string pointer, and translates to a `String` in QB64 (passed by reference, but that's the default). `LPSECURITY_ATTRIBUTES` is a pointer (LP), so it should be an `_Offset`. And `HANDLE` is a typedef for a `void *`, so in QB64 it should be an `_Offset`.

As a separate question, is there a reason you're trying to use `CreateFileA` and other Win32 APIs in the first place? The best way to make your program cross platform is to simply avoid using any `Declare Library` or Win32 APIs, and just use built-in commands like `OPEN` to create files. If you're not comfortable understanding the C++ types then you're likely to just keep running into issues trying to use Win32 APIs. They're all intended for being used in C++ code, not QB64, you can call them but you need C++ knowledge to really do it properly.
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: 2 Guest(s)