I want to dev a daemon which will capture screen of my OSX at pre login session
I have try by using Quazt display service (stream) and core graphic framework but it still unavailable
my code using Quartz service
m_isExit = FALSE;
m_display = kCGDirectMainDisplay; // 1
m_displayMode = CGDisplayCopyDisplayMode(m_display);
if (m_display == NULL)
{
throw Exception("OSX-Quart service Can not get Display mode ",VF_ERR_SCREEN_MONITOR_OSX_QUART_CREATE);
}
m_height = CGDisplayModeGetHeight(m_displayMode);
m_width = CGDisplayModeGetWidth(m_displayMode);
m_stream = CGDisplayStreamCreate(m_display,m_width,m_height,'BGRA',NULL,VncStreamFrameAvailableHandler);
if (m_stream == NULL)
{
throw Exception("OSX-Quart service Can not create Stream",VF_ERR_SCREEN_MONITOR_OSX_QUART_CREATE);
}it's always through exception. Another code using Core Graphic framework
m_mainDisplay = kCGDirectMainDisplay;
m_oriImage = CGDisplayCreateImage(m_mainDisplay);
if (m_oriImage == NULL)
{
throw Exception ("Core Graphic Can not Create original Image from display",VF_ERR_SCREEN_MONITOR_OSX_CG_CREATE);
}
ScreenGetConfigure(m_oriImage);
screenData.m_oriImage = m_oriImage;
m_oriPixelDataRef = CGDataProviderCopyData(CGImageGetDataProvider(m_oriImage));
if (m_oriPixelDataRef == NULL)
{
throw Exception ("Core Graphic Can not get pixel data ref",VF_ERR_SCREEN_MONITOR_OSX_CG_CREATE);
}Both code is not working at pre-login session.
Hope somebody can help me to fix the issue
MacBook, OS X El Capitan (10.11)