How To Determine If An LCD Is Off

I either need to determine if the LCD on a notebook has been closed or if the LCD has been turned off.

I've done a ton of research on this subject and I've determined that the latter of the two will be most likely obtainable.

I've asked this question many places and unable to get anything through those methods or plain research.

I did read about one question, where another guy was trying to obtain the same as me. One person suggested that the top level window receives a WM_SYSCOMMAND message with wParam set to SC_MONITORPOWER whenever the power status of a display is changing. But I'm afraid I'm not 100% sure how to work with that.

I tried using the WinProc method to determine if the message received was SC_MONITORPOWER, but that didn't work.

Then I saw a bit of code that allowed the user to turn the monitor on and off, but I don't think it can be used to determine the state.

I need this information badly, so if anyone can assist, I would really appreciate it.
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As IntPtr, ByVal wMsg As Integer, _
                                                                            ByVal wParam As Integer, ByVal lParam As Integer) As Integer
Private Const SC_MONITORPOWER As Integer = &HF170
Private Const WM_SYSCOMMAND As Integer = &H112
Private Const MONITOR_ON As Integer = -1
Private Const MONITOR_OFF As Integer = 2

SendMessage(Me.Handle, WM_SYSCOMMAND, SC_MONITORPOWER, MONITOR_OFF)

Open in new window

LVL 1
weirddemonAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
weirddemonAuthor Commented:
Absolutely amazing! I've been looking for this information for a very long time. I'm surprised I hadn't seen it earlier, but am very grateful! :)
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.