you should be able to figure it out from that.
and make sure you have the right version of windows
Client: Included in Windows XP and Windows 2000 Professional.
Server: Included in Windows Server 2003 and Windows 2000 Server.
Header: Declared in Winbase.h; include Windows.h.
Library: Use Kernel32.lib.
blackadder
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I am just newbie please can you post here sample code how can I implement this fnc.
I try write typedef and function into my code compilation is ok but linker write error
undefined reference to `GlobalMemoryStatusEx(_MEMORYSTATUSEX *)
Another question why MEMORYSTATUSEX starts with underscore in typedef ??
Thanks for help
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
GlobalMemoryStatusEx is a new API for Windows 2000 and XP.
Using it may make your application non-portable to older versions of windows.
Are you sure you cannot simply use GetGlobalMemoryStatus?
MEMORYSTATUSEX only adds the member ullAvailExtendedVirtual (which you probably can live without).
As for using a leading underscore (_) or double leading underscore(__) in a name : avoid doing so, custom reserves it for use by library writers and for external names.
Although, I do sometimes use _rr_ as a prefix for things.
rr
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
-
2003-06-12
_MEMORYSTATUSEX is the structure tag name for the structure MEMORYSTATUSEX is an instance of this structure, LPMEMORYSTATUSEX is a pointer to an instance of this structure.
The underscore is necessary to because the tag name must be a unique symbol. It must also be defined exactly as in the Win32 API otherwise it will not link to the relavent Windows system DLL.
rr is right about leading underscores being used for system libraries, and that is exactly why it is used here. It will not work without it.
Clifford
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I want use this function how can I add it to the DevC++ ?? in WinBase.h is only GlobalMemoryStatus of course MEMORYSTATUSEX structure is missing too
Thanks
Milan
you'll have add the function template and structure definition to the header files or to your program.
from the msdn site
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/memory/base/globalmemorystatusex.asp
BOOL GlobalMemoryStatusEx(
LPMEMORYSTATUSEX lpBuffer
);
typedef struct _MEMORYSTATUSEX { DWORD dwLength; DWORD dwMemoryLoad; DWORDLONG ullTotalPhys; DWORDLONG ullAvailPhys; DWORDLONG ullTotalPageFile; DWORDLONG ullAvailPageFile; DWORDLONG ullTotalVirtual; DWORDLONG ullAvailVirtual; DWORDLONG ullAvailExtendedVirtual;
} MEMORYSTATUSEX, *LPMEMORYSTATUSEX;
you should be able to figure it out from that.
and make sure you have the right version of windows
Client: Included in Windows XP and Windows 2000 Professional.
Server: Included in Windows Server 2003 and Windows 2000 Server.
Header: Declared in Winbase.h; include Windows.h.
Library: Use Kernel32.lib.
blackadder
I am just newbie please can you post here sample code how can I implement this fnc.
I try write typedef and function into my code compilation is ok but linker write error
undefined reference to `GlobalMemoryStatusEx(_MEMORYSTATUSEX *)
Another question why MEMORYSTATUSEX starts with underscore in typedef ??
Thanks for help
GlobalMemoryStatusEx is a new API for Windows 2000 and XP.
Using it may make your application non-portable to older versions of windows.
Are you sure you cannot simply use GetGlobalMemoryStatus?
MEMORYSTATUSEX only adds the member ullAvailExtendedVirtual (which you probably can live without).
As for using a leading underscore (_) or double leading underscore(__) in a name : avoid doing so, custom reserves it for use by library writers and for external names.
Although, I do sometimes use _rr_ as a prefix for things.
rr
_MEMORYSTATUSEX is the structure tag name for the structure MEMORYSTATUSEX is an instance of this structure, LPMEMORYSTATUSEX is a pointer to an instance of this structure.
The underscore is necessary to because the tag name must be a unique symbol. It must also be defined exactly as in the Win32 API otherwise it will not link to the relavent Windows system DLL.
rr is right about leading underscores being used for system libraries, and that is exactly why it is used here. It will not work without it.
Clifford