NextPVR Forums
  • ______
  • Home
  • New Posts
  • Wiki
  • Members
  • Help
  • Search
  • Register
  • Login
  • Home
  • Wiki
  • Members
  • Help
  • Search
NextPVR Forums Public NextPVR Support Windows v
« Previous 1 … 90 91 92 93 94 … 112 Next »
NPVR v5 no longer prevents shutdown with a remote

 
  • 0 Vote(s) - 0 Average
NPVR v5 no longer prevents shutdown with a remote
stwarr
Offline

Junior Member

UK
Posts: 8
Threads: 0
Joined: Jun 2020
#11
2020-07-02, 08:33 AM
As per the original post, I am talking about preventing the PC from entering sleep if triggered by (eg) a MCE remote. My usecase is HTPC running a 10 foot interface, with NextPVR server running on the same machine.

Ideally I’d like the same behaviour as WMC:

on & recording -> (power button) -> away mode -> (recording ends) -> sleep

If NextPVR cannot do this, is there any way of polling the server to determine the tuner status to allow an external app to achieve this?
Graham
Offline

Posting Freak

UK
Posts: 4,043
Threads: 102
Joined: Dec 2005
#12
2020-07-02, 11:24 AM
(2020-07-02, 08:33 AM)stwarr Wrote: ...  is there any way of polling the server to determine the tuner status to allow an external app to achieve this?

Does this do what you want ... https://github.com/sub3/NextPVR/wiki/nscripthelper
stwarr
Offline

Junior Member

UK
Posts: 8
Threads: 0
Joined: Jun 2020
#13
2020-07-02, 04:49 PM (This post was last modified: 2020-07-02, 04:50 PM by stwarr.)
A quick peek into NPVRTray.exe using ildasm.exe looks like the code defines a custom WndProc(), along with all the necessary power control enum values including WM_POWERBROADCAST, PBT_APMQUERYSTANDBY/PBT_APMQUERYSUSPEND, BROADCAST_QUERY_DENY, etc. but doesn't actually use them. Is this code that could be shared at all?



Code:
.method family hidebysig virtual instance void         WndProc(valuetype [System.Windows.Forms]System.Windows.Forms.Message& m) cil managed {   // Code size      61 (0x3d)   .maxstack  8   IL_0000:  ldarg.0   IL_0001:  ldfld      bool NPVRTray.Form1::shutdownBlocked   IL_0006:  brfalse.s  IL_0028   IL_0008:  ldarg.1   IL_0009:  call      instance int32 [System.Windows.Forms]System.Windows.Forms.Message::get_Msg()   IL_000e:  ldc.i4.s  17   IL_0010:  beq.s      IL_001c   IL_0012:  ldarg.1   IL_0013:  call      instance int32 [System.Windows.Forms]System.Windows.Forms.Message::get_Msg()   IL_0018:  ldc.i4.s  22   IL_001a:  bne.un.s  IL_0028   IL_001c:  ldarg.1   IL_001d:  ldsfld    native int [mscorlib]System.IntPtr::Zero   IL_0022:  call      instance void [System.Windows.Forms]System.Windows.Forms.Message::set_Result(native int)   IL_0027:  ret   IL_0028:  ldarg.1   IL_0029:  call      instance int32 [System.Windows.Forms]System.Windows.Forms.Message::get_Msg()   IL_002e:  ldc.i4    0x218   IL_0033:  pop   IL_0034:  pop   IL_0035:  ldarg.0   IL_0036:  ldarg.1   IL_0037:  call      instance void [System.Windows.Forms]System.Windows.Forms.Form::WndProc(valuetype [System.Windows.Forms]System.Windows.Forms.Message&)   IL_003c:  ret } // end of method Form1::WndProc
sub
Offline

Administrator

NextPVR HQ, New Zealand
Posts: 108,525
Threads: 786
Joined: Nov 2003
#14
2020-07-02, 05:25 PM
(2020-07-02, 04:49 PM)stwarr Wrote: A quick peek into NPVRTray.exe using ildasm.exe looks like the code defines a custom WndProc(), along with all the necessary power control enum values including WM_POWERBROADCAST, PBT_APMQUERYSTANDBY/PBT_APMQUERYSUSPEND, BROADCAST_QUERY_DENY, etc. but doesn't actually use them.
What version of windows are you running?

Those events can no longer be used to block standby in newer versions of Windows. Instead the try uses the following to block standby:

SetThreadExecutionState(ES_CONTINUOUS | ES_SYSTEM_REQUIRED | ES_AWAYMODE_REQUIRED);

If you're using some old version of Windows, maybe it's rejecting this call.
stwarr
Offline

Junior Member

UK
Posts: 8
Threads: 0
Joined: Jun 2020
#15
2020-07-02, 09:19 PM (This post was last modified: 2020-07-02, 09:27 PM by stwarr.)
Windows 10, build 2005, with all the latest updates
sub
Offline

Administrator

NextPVR HQ, New Zealand
Posts: 108,525
Threads: 786
Joined: Nov 2003
#16
2020-07-02, 09:37 PM
What date/time is your NextPVRTray.exe?
stwarr
Offline

Junior Member

UK
Posts: 8
Threads: 0
Joined: Jun 2020
#17
2020-07-02, 09:39 PM
According to the MSDN docs, SetThreadExecutionState() is only applicable to preventing sleep due to the idle timeout, it does not prevent a user initiated sleep command. I’m certainly not an expert, but the evidence shows (as shown by other PVRs being able to create powercfg entries) that the ability to prevent user initiated sleep commands requests still exists in windows 10, and must be based on some other mechanism. I’m only aware of the WM_POWERBROADCAST messages (and nothing in the MSDN docs suggests these are deprecated in windows 10), but maybe I’ll try and find some time to play around with this.
mvallevand
Online

Posting Freak

Ontario Canada
Posts: 56,811
Threads: 998
Joined: May 2006
#18
2020-07-02, 09:48 PM
The trap app is not blocking forced sleep or shutdown from the Start Menu on Win 10 2005 for me either. I didn't try on previous versions of Windows.

Martin
sub
Offline

Administrator

NextPVR HQ, New Zealand
Posts: 108,525
Threads: 786
Joined: Nov 2003
#19
2020-07-02, 10:02 PM
Let me know if this helps.

There was a attempted bug fix in the last release, which I think I got the logic reversed (related to running NextPVRTray.exe on another machine).


Attached Files
.zip   NPVRTray.zip (Size: 14.94 KB / Downloads: 8)
mvallevand
Online

Posting Freak

Ontario Canada
Posts: 56,811
Threads: 998
Joined: May 2006
#20
2020-07-02, 10:09 PM
That works for me.

Martin
« Next Oldest | Next Newest »

Users browsing this thread: 1 Guest(s)

Pages (3): « Previous 1 2 3 Next »


Possibly Related Threads…
Thread Author Replies Views Last Post
  NPVR Tray stuck showing EPG Updating Bobins 11 1,088 2026-09-20, 05:23 PM
Last Post: mvallevand
  Closed captioning in NPVR Joram 39 4,555 2026-09-10, 06:27 PM
Last Post: sub
  How to program the Green Button to launch NPVR? Joram 11 1,856 2026-08-20, 01:56 PM
Last Post: Bobins
  EPG No Longer Working - zap2xml SamM 57 21,062 2026-08-15, 02:23 PM
Last Post: johnharrisondev
Thumbs Down New USB Stick works with TVRPlayer won't scan channels in NPVR SteveEllard 1 535 2026-08-01, 06:33 PM
Last Post: mvallevand
  Guide data no longer updating after updating bac80 16 1,504 2026-07-12, 01:16 PM
Last Post: mvallevand
  Continued issues, how is this not related to NPVR? Ricknextpvr 12 2,210 2026-06-23, 10:45 PM
Last Post: Ricknextpvr
  Problems with NPVR offline installation Joram 11 1,455 2026-06-15, 11:46 PM
Last Post: sub
  Cableco DVR with six tuners, can NPVR use more than one? Joram 9 1,175 2026-04-28, 04:31 PM
Last Post: Joram
  NPVR UI not picking up TV signal Joram 9 1,256 2026-03-15, 10:06 PM
Last Post: Joram

  • View a Printable Version
  • Subscribe to this thread
Forum Jump:

© Designed by D&D, modified by NextPVR - Powered by MyBB

Linear Mode
Threaded Mode