#include "include.h"
#include <Windows.h>
#include <string.h>
   
Napi::Array monitor_info(const Napi::CallbackInfo& info){
    Napi::Env env=info.Env();
    int i=0;
    DISPLAY_DEVICE device;
    Napi::Array array;
    for(int i=0;i<EnumDisplayDevices(NULL, i, &device, EDD_GET_DEVICE_INTERFACE_NAME);i++){
        DEVMODE settings;
        EnumDisplaySettings(device.DeviceName, ENUM_CURRENT_SETTINGS, &settings);
        Napi::Object deviceObj;
        deviceObj.Set<DWORD>("pixWidth",settings.dmPelsWidth);
        deviceObj.Set<DWORD>("pixHeight",settings.dmPelsHeight);
        deviceObj.Set<DWORD>("colorDepth",settings.dmBitsPerPel);
        deviceObj.Set<DWORD>("freq",settings.dmDisplayFrequency);
        array.Set<Napi::Object>(i, deviceObj);
    }
    i++;
    return array;
}