Jump to content

WM_QUERYENDSESSION TRUE?


majstang

Recommended Posts

Is it possible to force DVBViewer to reply TRUE on a WM_QUERYENDSESSION message?

 

Simply write a small application with c, autoit or any other tool you like. Run it in background and wait for this kind of message. If it arrives kill the DVBViewer Process or send a WM_CLOSE to his Window. After that call shutdown or standby via API.

 

Endless discussion about this issue. In my opinion it's a bad behaviour if an application denies standby or shutdown. But developers of DVBViewer won'T change this. So help yourself :whistle:

Link to comment

Simply write a small application with c, autoit or any other tool you like. Run it in background and wait for this kind of message. If it arrives kill the DVBViewer Process or send a WM_CLOSE to his Window. After that call shutdown or standby via API.

 

Endless discussion about this issue. In my opinion it's a bad behaviour if an application denies standby or shutdown. But developers of DVBViewer won'T change this. So help yourself :whistle:

Uh, this would require pages of information to fully explain what im after.

Well, my intension is to use shutdown block and cancel to be abled to delay and execute standby/hibernate instead, but DVBViewer keeps on throwing curveballs. If nothing else works the last way out would be to close the DVBViewer process, but i will try to avoid that as long as possible since that will create problems longer up the road. My issue is the "Force Shutdown full screen UI". I simply wanna get rid of it. When DVBV is the last started application it will end up as number one app on the full screen UI and this makes my shutdownblock script to fail (script automation stalls) and it requires a manual input to go futher which is unacceptable. When shutdownblockscript is the first app on the list everything goes well and im abled to cancel out the full screen UI per automatic.

What I dont understand and hopefully there is a Windows Vista/7 Guru in here that could expalin this to me:

1) What decides the numerical order of the applications (the blocking applications) in the fullscreen UI?

2) Can I change this order somehow to make a certain application to always end up as number one at the list when a shutdownblock occurs?

3) Can ShutdownBlockReasonCreate set a higher priority/numerical order for an application and lower an another besides giving the user a shutdownblock reason?

 

Sadly searching Google and Microsoft sites gives very little.

Edited by majstang
Link to comment

Well, my intension is to use shutdown block and cancel to be abled to delay and execute standby/hibernate instead, but DVBViewer keeps on throwing curveballs.

 

Still don't understand what you like to do.

 

If you like avoid the shutdown function in DVBViewer simply disable the entry in the OSD. Maybe another way is to redefine the shutdown action in the Command.vbs.

Link to comment

Ok, I did try to avoid it, but it seems the long version is required to make myself clear on what im after.

If I understands it right, you as well have created a Standby/hibernation script for use as an After Recording Task in Recording Service. Meaning after each recording is done HTPC will standby/hibernate only on times you specify as a user (havent seen your script so i dont exactly know how it works).

 

On times when the standby/hibernationscript will allow standby/hibernation on ones HTPC I would like to have an opportunity to block and delay standby/hibernation, exactly as is possible with WindowsXP, on Windows 7 as well. As most advanced users of Windows 7/Vista has discovered Microsoft have removed the possibility to block/delay standby/hibernation entirely, cuz the new MS Operation Systems are being developed mainly for use with Laptops (limited battery time). Mindboggling they didn't give us two options, cuz there are many desktop users out there still. So, what to do if not standby/hibernations is blockable anymore? As a workaround one will try to work with the powermessages which still are blockable, in other words Shutdown. Instead of sending standby/hibernation from the After Recording Task/script I will use shutdown. An another script (the shutdownblockscript) will block the shutdown and quickly cancel the shutdown process down. This buys me time and allows me to send and if I want delay what ever powermessage I wanna use. If I wanna hibernate from here or cancel the close down entirely no problem. The messagebox with these power-options will timeout after 20 seconds and hibernation will be executed per default when countdown is finished. An important criteria for this to work is that everything is fully automated. If user is nowhere nearby the HTPC and finds it stalled when coming back due to a crappy script one will stop using that script quite fast.

 

The "evil" basterds from Microsoft wasn't satisfied with removing the block of Standby/Hibernation, they also decided to remove "silent block". On WinXP when you block a powermessage you will most of the time not get any UI telling you if an application blocks the shutdown/hibernation/standby. On Windows Vista/7 they decided to introduce the most annoying crap ever, a full screen UI which lists all applications that reply false (blocks the shutdown) on the sent WM_QUERYENDSESSION. When trying to fully automate things with a script the least thing you wanna have is a freaking UI that you dont understand the mechanisms behind and no way of control it, besides two buttons ("Force shutdown" and "Cancel"). As said earlier my issue begins when DVBV is the last started application it will end up as number one application on the full screen UI and this makes my shutdownblock script to fail (script automation stalls) and it requires a manual input to go futher which is unacceptable. When shutdownblockscript (this script/application also replies false) is the first application on the list everything goes well and im abled to cancel out the full screen UI per automatic.

 

Still don't understand what you like to do.

Well, I wanna do the following:

Delay or block out DVBViewers reply on the WM_QUERYENDSESSION. When I wrote this post I wanted to know if somebody had any ideas what was possible. Now I did found something intresting named

"SetProcessShutdownParameters" which could do exactly what Im after, altering priority of the applications on the fullscreen UI. If this is doable I could delay DVBViewer queryendsession reply exactly as long as it takes to cancel out the full screen UI. When the reply arrives the full screen UI are already closed. Since Im really bad at C# and there is a learningcurve plus limited time things goes ahead with snail pace right now. Still have no idea if this could work though.

 

I do not wanna take the easy way out and close DVBViewer before intercepting/blocking the shutdown call, cuz I want DVBViewer to be running when HTPC resumes from hibernation. If I close DVBV I have to start it again and that means an another script. I wanna keep the number of scripts, to pulling this kind of thing off, to a minimum...as clean as possible.

 

Best Regards

Majstang

Edited by majstang
Link to comment

Solved it! :biggrin:

This line in the beginning of the script takes care of business:

DllCall("kernel32.dll\SetProcessShutdownParameters", UInt, 0x4FF, UInt, 0)

This forces Windows to attempt to close this script on shutdown before any other process.

Edited by majstang
Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...