SOL9 2.0 Class: GlobalMemory

 SOL9 C++ Class Library  SOL9 Samples  SOL9 Tutorial  SOL9 FAQ  SOL9 ClassTree 

Source code

/*
 * GlobalMemory.h 
 * Copyright (c) 2011 Antillia.com TOSHIYUKI ARAI. ALL RIGHTS RESERVED. 
 */


// SOL++2000
#pragma once

#include <sol\Object.h>

namespace SOL {

class GlobalMemory :public Object {
    HANDLE handle;
    LPSTR  buffer;
  public:
    GlobalMemory(DWORD size) {
        handle = GlobalAlloc(GMEM_MOVEABLE|GMEM_ZEROINIT, size);
        buffer = (LPSTR)GlobalLock(handle);
    }
    ~GlobalMemory() {
        GlobalUnlock(handle);
        GlobalFree(handle);
    }
    LPSTR  getBuffer()  { return buffer; }
    HANDLE getHandle() { return handle; }
};

}



Last modified: 1 Feb 2012

Copyright (c) 2009-2012 Antillia.com ALL RIGHTS RESERVED.