Do people mind if I have a discussion here about the LongPtr stuff?
I'm converting a few procedures from VB6 to VBA, and a few of them make API calls. I need for this stuff to run on both VBA 32-bit and VBA 64-bit. I'm well aware of the VB7 and Win64 compile-time constants, and I'm using them. That's not exactly the problem.
For the most part, I've just been googling my API call names (along with "PtrSafe") to see if I can find the 64-bit declarations. However, there's lots of garbage out there.
I suppose, I'd just like to nail-down a good understanding of the Microsoft MSDN types, and understand which ones need the LongPtr declaration. Here's the start of a list of the types I'm seeing:
Actually, I think I'm ok on most of them. If I understand correctly, this is how it should go:
I haven't researched out all the VBA 64-bit stuff, but I believe that form and control hWnd properties return 64-bits. Also, I believe StrPtr also returns 64-bits. And this is important to know when making these API calls.
And, just as an example, I'm a bit uncertain how to declare EnumProcessModules when VBA7=True.
Any comments on this would be greatly appreciated.
EDIT: And I'm also well aware of this page: https://docs.microsoft.com/en-us/win...ows-data-types
But that doesn't exactly answer all the questions, or maybe it does, and I'm just not clear.
I'm converting a few procedures from VB6 to VBA, and a few of them make API calls. I need for this stuff to run on both VBA 32-bit and VBA 64-bit. I'm well aware of the VB7 and Win64 compile-time constants, and I'm using them. That's not exactly the problem.
For the most part, I've just been googling my API call names (along with "PtrSafe") to see if I can find the 64-bit declarations. However, there's lots of garbage out there.
I suppose, I'd just like to nail-down a good understanding of the Microsoft MSDN types, and understand which ones need the LongPtr declaration. Here's the start of a list of the types I'm seeing:
Code:
HANDLE
HMODULE
HINSTANCE
DWORD
LPDWORD
HWND
BOOL
UINT
LPWSTR
LPTSTR
LPCWSTR
INT
Code:
HANDLE LongPtr
HMODULE LongPtr
LPDWORD LongPtr
HWND LongPtr
LPWSTR LongPtr
LPTSTR LongPtr
LPCWSTR LongPtr
DWORD Long
BOOL Long
UINT Long (careful with VB6/VBA sign-bit)
INT Long
And, just as an example, I'm a bit uncertain how to declare EnumProcessModules when VBA7=True.
Any comments on this would be greatly appreciated.
EDIT: And I'm also well aware of this page: https://docs.microsoft.com/en-us/win...ows-data-types
But that doesn't exactly answer all the questions, or maybe it does, and I'm just not clear.