[windev] opposite of SC_MONITORPOWER?
Mark McGinty
mmcginty at dbunwired.com
Thu Jul 16 18:21:57 GMT 2009
> -----Original Message-----
> From: windev-bounces at windev.org
> [mailto:windev-bounces at windev.org] On Behalf Of Drew
> Sent: Thursday, July 16, 2009 7:54 AM
> To: windev at windev.org
> Subject: Re: [windev] opposite of SC_MONITORPOWER?
>
> According to the docs I saw LPARAM is -1 for power on for
> SC_MONITORPOWER.
Maybe later O/S? (I'm primarily running XP x64.) The reverse can be
inferred from any of several UI-related events (WM_ACTIVATE, WM_MOUSEMOVE,
WM_SETFOCUS, etc.) A little messy but reliable enough, I think.
> But if you only get the message if your app is active then
> you probably will need a global hook.
It gets worse, the only unfiltered Windows message hook type is
WH_GETMESSAGE, which depends on GetMessage() being called. For messages
like this one that are only sent to the active app, it depends on that
active app calling GetMessage(). If the active app happens to be, say, a
console, or something else that either does not have a message loop, or
doesn't call GetMessage to service it, the hook fails to catch the event.
More, if the hook happens to be 32 bit and a 64 bit process is active when
it happens, again, no event.
PostMessage works across 32/64 bit process boundaries, right? So I could
set a 64 bit hook too, and it could send WM_USER + n messages to a 32 bit
control app (or vice versa)?
I suppose it's a good thing I spend most of my time in some version or other
of either Dev Studio or Office apps, none of which, at this moment, offer
native 64 bit editions...
> Another option which
> may or may not work for you is the IMSVidDevice interface
> described at:
>
> msdn.microsoft.com/en-us/library/dd694519(VS.85).aspx
Interesting stuff... Looks like I'd have to poll status to detect a change
(though that might easily be more efficient, and would surely be safer, than
setting two system hooks [on 64 bit systems.]) I'll take a closer look next
time I work on this again.
In case you're wondering about the application... My house got broken-into
while I was away on business. I bought a surveillance cam, which came with
a bunch of software, but what I want it to do is, when a motion detect event
fires, upload a still to off-site FTP, start streaming video to disk
(uploaded to FTP in n second segments) and send an MMS message with a link
to the still, to my mobile. This gives me a photo record of the
perpetrator[s] stored in a safe location, and heads-up notification about
the incursion (with said photo at my fingertips wherever I may be.)
But it would be ridiculous to have this thing pumping pictures of me working
to my hosting provider; I also don't want to have to remember to enable it
manually before I leave. While the monitor is powered-down due to
inactivity, chances are extremely good that I am not at my desk... So it
seemed like a pretty good fit for my purposes... But in the harsh light of
reality, it is less than perfect, by definition.
Thanks,
MM
> Drew
>
> -----Original Message-----
> From: windev-bounces at windev.org
> [mailto:windev-bounces at windev.org] On Behalf Of Mark McGinty
> Sent: Thursday, July 16, 2009 6:07 AM
> To: windev at windev.org
> Subject: [windev] opposite of SC_MONITORPOWER?
>
> Greets,
>
> I'm processing WM_SYSCOMMAND -> SC_MONITORPOWER to detect
> when the monitor[s] get turned off due to inactivity -- no
> issues there. But I also want to know when the monitor[s]
> get turned back on again. WM_SYSCOMMAND -> SC_MONITORPOWER
> has no parameter value for this, it's 1 for going to low
> power, 2 for going power off, and... that's it.
>
> I sort-of expected WM_POWERBROADCAST to notify me of this,
> but it doesn't seem to know anything about monitor power
> (only system power.)
>
> I logged the message traffic after the screens kick on, I
> guess I can infer from WM_ACTIVATE or something -- oh man! I
> only get WM_SYSCOMMAND -> SC_MONITORPOWER if my app is active
> when it happens? That's lame!
>
> So I suppose I need a global msg hook? Or is there some
> other way to detect this event?
>
>
> TIA,
> MM
>
>
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL:
> http://lists.windev.org/pipermail/windev/attachments/20090716/
> df45662e/attac
> hment.htm
> --
> Windev mailing list at Windev at windev.org
>
> Lost your password? Need to unsubscribe or change your
> delivery options?
> Go to http://lists.windev.org/mailman/listinfo/windev
> --
> Search the Windev Archives - www.windev.org
>
> --
> Windev mailing list at Windev at windev.org
>
> Lost your password? Need to unsubscribe or change your
> delivery options?
> Go to http://lists.windev.org/mailman/listinfo/windev
> --
> Search the Windev Archives - www.windev.org
>
More information about the Windev
mailing list