LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Why Doesn't LabVIEW Intercept the WM_SYSCOMMAND Windows Message?

Hrph... doesnt work huh...
Well thats interesting.

Works just fine on my XP Pro SP2 machine at home because thats where I coded it up.
I set the screen saver to go off after one minute and let it sit there for a couple of hours while I watched TV heh.

I can check it again when I get back there tonight to see if I might have sent an older version from testing but I dont think so. If its the final file and its working on my machine I will have no way to troubleshoot for it not working somewhere else and ill just have to let the subject drop 😕
0 Kudos
Message 11 of 17
(2,175 Views)
Which "Windows Messaging" VIs are you using? I'm assuming that you're using the EPD VIs found here. If that is the case, these do not offer a way to respond to a message. However, since the code DLL code is available, you might be able to modify it to respond to the message rather than setting the occurence.
0 Kudos
Message 12 of 17
(2,072 Views)
I dont think its that easy. Thats why I was trying to code it up as a seperate application. Returning a -1 (at least on my XP machine) does not stop the screen saver from starting. Thats the first thing I tried when I was building up that exe file for him.

Its really rather interesting and there are alot of factors involved. For one a hidden application (non-visible) wont get the WM_SYSCOMMAND messages and neither will one that is minimized. It initially took me awile to figure this out during testing. I was able to get around these issues partly by using the extended style WS_EX_TOOLWINDOW. This style does not hide the window from the screen but Windows will not place a button in the taskbar for it which is nice for this kind of application. The other thing is (and one which I think my current version is failing at) is that the application has to stay active. My application is not hidden per se. Simply started off screen (origin -250 y).

I am now thinking Windows, after a pre-determined time, will flag an application as idle after awile so I just need to add a timer and fake a keystoke like once every five minutes... I will post up a modified version tonight to see if fixes the issue its currently having.

Chaos
0 Kudos
Message 13 of 17
(2,063 Views)
Thanks all for your replies. I have only been able to START the screen saver by sending WM_SYSCOMMAND with SC_SCREENSAVE to the DefWindowProc function in User32.dll. I am not feeling too confident about the elegant solution so I may take a stab at your suggestion, Chaos and try some keystrokes every n number of minutes.

And if anyone comes up with a way to reply to a WM from LabVIEW, I'm all eyes!!
0 Kudos
Message 14 of 17
(2,059 Views)
try using this vi and set it to not active, I have really never used this vi on XP, but maybe if you put it at the beginning of the vi it will not let the screensaver start. you can also set the parameters for the screensaver.

you have probably already tried this but I'm just trying to help.


Forgot to post vi

Message Edited by jhoskins on 06-10-2005 02:33 PM

Message Edited by jhoskins on 06-10-2005 02:34 PM

Message Edited by jhoskins on 06-10-2005 02:39 PM




Joe.
"NOTHING IS EVER EASY"
0 Kudos
Message 15 of 17
(2,056 Views)
Ok new version, please test to see if this ones working on your machine...
Traps WM_SYSCOMMAND and is also working off a 10 second timer. If either event occurs a fake keypress is simulated to the system which should (in theory) stop any screen saver from activating.
Message 16 of 17
(2,022 Views)

@chaos wrote:
Ok new version, please test to see if this ones working on your machine...
Looks like it works 🙂

I'll file that away for future use.

Thanks


Ed Dickens - Certified LabVIEW Architect
Lockheed Martin Space
Using the Abort button to stop your VI is like using a tree to stop your car. It works, but there may be consequences.
0 Kudos
Message 17 of 17
(2,010 Views)