On today, of all days, here's some help waking up...Your monitor at least!

Description

I debated doing a Gallery post for today since that it's the Thanksgiving holiday in the United States. But then realized I could do the that post title... Wink

Today's entry is pretty simple, yet a pretty cool example too. Besides being C++, it's also something that struck a cord with many and seems to make allot of sense in concept.

To wake up the monitor screen

I do use Kinect to wake up my monitor from sleeping (power down after screensaver).
This must be done when Kinect recognizes someone's body in front of his camera view.

Open SDK's Sample Skeletal Viewer project.

Open NuiImpl.cpp file

Find the line:

if (pSkel->eSkeletonPositionTrackingState[i] != NUI_SKELETON_POSITION_NOT_TRACKED)

This is the moment when Kinect recognizes the body and construct skeletal data ready to display.

Add the following inside the above function:

if (b_monitoroff) 
{
b_monitoroff = false;

// force monitor power up
SendMessage(HWND_BROADCAST, WM_SYSCOMMAND, SC_MONITORPOWER, (LPARAM)-1);
}
Of course, declare: bool b_monitoroff; in the beginning of SkeletalViewer.h

Open SkeletalViewer.cpp

Find the main window (dialog) route function and add:

case WM_SYSCOMMAND:
switch (wParam)
{
case (SC_MONITORPOWER):
else if (lParam!=-1 && !b_monitoroff)
{
// monitor power gone down
b_monitoroff = true;
}
break;
default:
return 0;
}
break;

That's all! From now, when you monitor gone down (with or without screensaver),
then when you will step beside Kinect camera, after a while the monitor will wake up.

...

Project Information URL: http://www.jgui.net/kinect/index.html#snippet1

Project Download URL: http://www.jgui.net/kinect/index.html#snippet1

The Discussion

Comments closed

Comments have been closed since this content was published more than 30 days ago, but if you'd like to continue the conversation, please create a new thread in our Forums, or Contact Us and let us know.