Set storage used memory

Set storage used memory

Postby Antonio Linares » Tue Sep 01, 2009 9:23 am

These new functions allow you to reduce the storage space and increase the free memory:
Code: Select all  Expand view

typedef BOOL  ( __stdcall * GetSystemMemoryDivisionProc )( LPDWORD, LPDWORD, LPDWORD );
typedef DWORD ( __stdcall * SetSystemMemoryDivisionProc )( DWORD );

HB_FUNC( GETMEMDIVISION )
{
    HINSTANCE hCoreDll = LoadLibrary(_T("coredll.dll"));
    GetSystemMemoryDivisionProc procGet =
        (GetSystemMemoryDivisionProc)GetProcAddressW(
        hCoreDll, _T("GetSystemMemoryDivision"));

    DWORD dwStoragePages;
    DWORD dwRamPages;
    DWORD dwPageSize;

    procGet( &dwStoragePages, &dwRamPages, &dwPageSize );
   
    hb_reta( 3 );
    hb_stornl( dwStoragePages, -1, 1 );
    hb_stornl( dwRamPages, -1, 2 );
    hb_stornl( dwPageSize, -1, 3 );

    FreeLibrary( hCoreDll );
}

HB_FUNC( SETMEMDIVISION )
{
    int nStoragePages = hb_parnl( 1 );

    HINSTANCE hCoreDll = LoadLibrary(_T("coredll.dll"));
    SetSystemMemoryDivisionProc procSet =
        (SetSystemMemoryDivisionProc)GetProcAddressW(
        hCoreDll, _T("SetSystemMemoryDivision"));

    hb_retnl( procSet( nStoragePages ) );

    FreeLibrary(hCoreDll);
}

#pragma ENDDUMP
 

Explanation here:
http://www.pocketpcdn.com/articles/memorydivision.html
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42081
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Return to FiveWin for Pocket PC

Who is online

Users browsing this forum: No registered users and 25 guests