Why use Byte Ptr and not say Int Ptr for this?
lpBuffer is supposed to be this structure:
And if I create an instance of TMemoryStatus with new and pass it into GlobalMemoryStatus, it works totally fine.
Thing is I don't really understand what's going on. Why is Byte Ptr is used in the function declaration instead of say Int Ptr? Is Byte pointer the normal thing you use when you point to a Type (structure) because it's a pointer to an area of memory that can be read as bytes, or what?
Thanks for any insight, hope I'm making myself clear. I still haven't had that cup of tea...
Extern "win32" Function GlobalMemoryStatus(lpBuffer:Byte Ptr) End Extern
lpBuffer is supposed to be this structure:
Type TMemoryStatus 'for use with GlobalMemoryStatus Field dwLength:Int Field dwMemoryLoad:Int Field dwTotalPhys:Int Field dwAvailPhys:Int Field dwTotalPageFile:Int Field dwAvailPageFile:Int Field dwTotalVirtual:Int Field dwAvailVirtual:Int Method New() 'Must set the length. dwLength=SizeOf(TMemoryStatus) End Method EndType
And if I create an instance of TMemoryStatus with new and pass it into GlobalMemoryStatus, it works totally fine.
Thing is I don't really understand what's going on. Why is Byte Ptr is used in the function declaration instead of say Int Ptr? Is Byte pointer the normal thing you use when you point to a Type (structure) because it's a pointer to an area of memory that can be read as bytes, or what?
Thanks for any insight, hope I'm making myself clear. I still haven't had that cup of tea...