On today, of all days, here's some help waking up...Your monitor at least!
- Posted: Nov 24, 2011 at 6:00AM
- 5,033 views
- 1 comment
Loading user information from Channel 9
Something went wrong getting user information from Channel 9
Loading user information from MSDN
Something went wrong getting user information from MSDN
Loading Visual Studio Achievements
Something went wrong getting the Visual Studio Achievements
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...
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.
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)Of course, declare: bool b_monitoroff; in the beginning of SkeletalViewer.h
b_monitoroff = false;
// force monitor power up
SendMessage(HWND_BROADCAST, WM_SYSCOMMAND, SC_MONITORPOWER, (LPARAM)-1);
Find the main window (dialog) route function and add:case WM_SYSCOMMAND:
else if (lParam!=-1 && !b_monitoroff)
// monitor power gone down
b_monitoroff = true;
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