What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » GlobalMemoryStatusEx function???

GlobalMemoryStatusEx function???
Author: Message:
agustin029
New Member
*

Avatar

Posts: 5
30 / Male / Flag
Joined: Feb 2012
O.P. GlobalMemoryStatusEx function???
how I can use this function in javascript??


http://msdn.microsoft.com/en-us/library/windows/d...6589(v=vs.85).aspx

code:
mem32 = Interop.Call('kernel32', 'GlobalMemoryStatusEx', 'MEMORYSTATUSEX');
var string_memory = mem32.dwMemoryLoad; ??

09-14-2012 01:22 AM
Profile E-Mail PM Find Quote Report
Spunky
Former Super Mod
*****

Avatar

Posts: 3658
Reputation: 61
35 / Male / Flag
Joined: Aug 2006
RE: GlobalMemoryStatusEx function???
MEMORYSTATUSEX isn't a String, it's a structure. The documentation for it can be found here

You will need to use Data Blocs to emulate the structure and then you can read information out with functions like
Javascript code:
myDataBloc.readDWORD(0);

as described in the documentation for MP! scripting
<Eljay> "Problems encountered: shit blew up" :zippy:
09-14-2012 07:39 AM
Profile PM Find Quote Report
matty
Scripting Guru
*****


Posts: 8336
Reputation: 109
39 / Male / Flag
Joined: Dec 2002
Status: Away
RE: GlobalMemoryStatusEx function???
Javascript code:
/*
    typedef struct _MEMORYSTATUSEX {
      DWORD     dwLength;                       0
      DWORD     dwMemoryLoad;                   4
      DWORDLONG ullTotalPhys;                   8
      DWORDLONG ullAvailPhys;                   16
      DWORDLONG ullTotalPageFile;               24
      DWORDLONG ullAvailPageFile;               32
      DWORDLONG ullTotalVirtual;                40
      DWORDLONG ullAvailVirtual;                48
      DWORDLONG ullAvailExtendedVirtual;        56
    } MEMORYSTATUSEX, *LPMEMORYSTATUSEX;
*/

var DIV = 1024;
var _MEMORYSTATUSEX = Interop.Allocate(64);
    _MEMORYSTATUSEX.WriteDWORD(0, _MEMORYSTATUSEX.Size);
Debut.Trace('RetVal: '+Interop.Call('kernel32', 'GlobalMemoryStatusEx', _MEMORYSTATUSEX));
 
Debug.Trace('There is '+_MEMORYSTATUSEX.ReadDWORD(4)+' percent of memory in use.');
Debug.Trace('There are '+_MEMORYSTATUSEX.ReadDWORD(8)/DIV+' total KB of physical memory.');
Debug.Trace('There are '+_MEMORYSTATUSEX.ReadDWORD(16)/DIV+' free  KB of physical memory.');
Debug.Trace('There are '+_MEMORYSTATUSEX.ReadDWORD(24)/DIV+' total KB of paging file.');
Debug.Trace('There are '+_MEMORYSTATUSEX.ReadDWORD(32)/DIV+' free  KB of paging file.');
Debug.Trace('There are '+_MEMORYSTATUSEX.ReadDWORD(40)/DIV+' total KB of virtual memory.');
Debug.Trace('There are '+_MEMORYSTATUSEX.ReadDWORD(48)/DIV+' free  KB of virtual memory.');
Debug.Trace('There are '+_MEMORYSTATUSEX.ReadDWORD(56)/DIV+' free  KB of extended memory.');

09-14-2012 12:13 PM
Profile E-Mail PM Find Quote Report
agustin029
New Member
*

Avatar

Posts: 5
30 / Male / Flag
Joined: Feb 2012
O.P. RE: GlobalMemoryStatusEx function???
i think i need to learn more =S, thank you very much!
09-15-2012 02:47 AM
Profile E-Mail PM Find Quote Report
« Next Oldest Return to Top Next Newest »


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On