Jump to content

OnMessage intercepting hibernation trouble


majstang

Recommended Posts

Since there is no userinteraction allowed with scripts runned from within Recording Service i made this Autohotkey script in order to intercept the hibernation call (coming from the After recording task im having with an OnMessage command)) and quickly close this function down. In this way taking control of the hibernation process and it gives me the opportunity to have some userinteraction using a script runned outside of RecService.

A messagebox pops up when hibernation is intercepted and gives you the following options:

Press "Yes" button and Hibernation initiates

Press "No" button script breaks and does nothing

If no presses are registred hibernation will initiate after 20 seconds

 

However i did come across a really annoying quirk:

 

If watching TV (DVBViewer is the activated window) when the hibernating call comes...this brings down the graph (DVBViewer goes black).

 

It seems DVBViewer is very sensitive and goes to far. Why does DVBV close the graph when it should not? TSPlayer and MPC-HC does not when the hibernation call is intercepted. Is there a way to make DVBV not behave like this?

 

Please le me know if something is unclear and i will try to explain better...im REALLY keen on getting this to work and would appreciate any thoughts anyone have on the matter. Im using the DVBV 4.2.1. and DVBV beta 160...both does the same.

 

Regards

Majstang

 

#Persistent
OnMessage(0x0218, "OnPBMsg")
hibernate = 0
Return


OnPBMsg(wParam, lParam, msg, hwnd) {
  global hibernate
  If (wParam = 0 or wParam=4)
  {   ;PBT_APMQUERYSUSPEND
     If (lParam & 1)   ;Check action flag
     {
        if (hibernate = 0)
        {
           SetTimer, InterceptPBMSG, -1
           Return 1112363332
        }
        else
           Return 4
     }
  }
  ;Must return True after message is processed
  Return True
}

InterceptPBMSG:
MsgBox, 36, Your HTPC is about to be Hibernated, Allow it?, 20
IfMsgBox, Yes
{
  hibernate = 1
  DllCall("PowrProf\SetSuspendState", "int", 1, "int", 0, "int", 0)
  hibernate = 0
  Return
}
IfMsgBox, Timeout
{
  hibernate = 1
  DllCall("PowrProf\SetSuspendState", "int", 1, "int", 0, "int", 0)
  hibernate = 0
  Return
}
IfMsgBox No
{
  hibernate = 0
  return
}

Edited by majstang
Link to comment

This will NOT work under Vista/Win7. PBT_APMQUERYSTANDBY and PBT_APMQUERYSUSPEND do not work there anymore. And it might interfere with the task scheduler.

 

What does the debug.log say, if you start the viewer in debug mode?

Link to comment

This will NOT work under Vista/Win7. PBT_APMQUERYSTANDBY and PBT_APMQUERYSUSPEND do not work there anymore.

Yes, I know Im using XP, but if someone wants this script to be adapted to Vista/Win7 there is a way.

 

And it might interfere with the task scheduler.

In what way do you reckon?

 

 

What does the debug.log say, if you start the viewer in debug mode?

 

Here is the debug.log and as you see sessions ends with:

Powermessage PBT_APMQUERYSTANDBY

 

Which im not using...should be PBT_APMQUERYSUSPEND if something at all.

 

Howcome DVBViewer closes graph when it really shouldnt, cuz function should be closed before even reaching DVBViewer? No other player i have tried acts this way. Only DVBV is affected.

 

Debug.log taken when the hibernation call is made and my script intercepts the hibernation and DVBV graph closes during the OnMessage part in my script:

04.07.10 17:20:56.250 SetThreadExecutionState 0x80000001

04.07.10 17:20:56.250 Start App ----------------------------------------

04.07.10 17:20:56.250 Start App DVBViewer.exe

04.07.10 17:20:56.250 Start App 4.3.1.160 (beta)

04.07.10 17:20:56.250 Start App ----------------------------------------

04.07.10 17:20:56.968 TDVBDevice.InitDevice FireDTV BDA Tuner DVBC (1)

04.07.10 17:20:56.968 TDVBDevice.InitDevice FireDTV BDA Tuner DVBC (2)

04.07.10 17:20:56.968 TDVBDevice.InitDevice Unicast Network Device

04.07.10 17:20:56.968 TDVBDevice.InitDevice Unicast Network Device 2

04.07.10 17:20:56.968 Device Check present

04.07.10 17:20:56.968 CheckDevicespresent start

04.07.10 17:20:56.968 DevicePath \\?\avc#digital_everywhere&firedtv_c#ci&typ_5&id_0#4f25000226871200#{71985f48-1ca1-11d3-9cc8-00c04f7971e0}\{db365890-165f-11d0-a195-0020afd156e4}

04.07.10 17:20:56.968 DevicePath \\?\avc#digital_everywhere&firedtv_c#ci&typ_5&id_0#d111000226871200#{71985f48-1ca1-11d3-9cc8-00c04f7971e0}\{db365890-165f-11d0-a195-0020afd156e4}

04.07.10 17:20:57.421 DevicePath \\?\hdaudio#func_01&ven_1002&dev_aa01&subsys_00aa0100&rev_1000#5&7a190dd&0&0001#{65e8773d-8f56-11d0-a3b9-00a0c9223196}\atirearlineoutwave

04.07.10 17:20:57.421 DevicePath \\?\hdaudio#func_01&ven_10ec&dev_0883&subsys_1043829f&rev_1000#4&196e0bad&0&0001#{65e8773d-8f56-11d0-a3b9-00a0c9223196}\rearlineinwave3

04.07.10 17:20:57.562 LoadWindowDefs Loading WindowDefFile: C:\Documents and Settings\All Users\Application Data\CMUV\DVBViewer\windowdef.xml

04.07.10 17:20:57.640 Settuner Start

04.07.10 17:20:57.640 TCMDSocketThread Sessionstarted

04.07.10 17:20:57.640 TUCStreamThread Sessionstarted

04.07.10 17:20:57.640 Gotstr OK.

04.07.10 17:20:57.640 TfrmMain Allocate Unicast Network Device

04.07.10 17:20:57.640 Settuner Found usable hardware

04.07.10 17:20:57.640 TDVBHardware.SetTuner PMT: 307 - SID: 1012 - Freq: 482000 - Type: 0

04.07.10 17:20:57.640 Sendstr SETTUNER 0 482000 6875 0 0 3 3 0 4403 4147 307 1012 0 0 0 25 0 45 40999

04.07.10 17:20:58.109 Gotstr CAMAVAIL -1

04.07.10 17:20:58.109 Gotstr OK.

04.07.10 17:20:58.109 Sendstr ADDPID 18

04.07.10 17:20:58.109 Settuner End

04.07.10 17:20:58.125 Sendstr ADDPID 4147 4403 0 307 7987

04.07.10 17:20:58.125 AddAVCodecs VCodec: CyberLink Video/SP Decoder (PDVD9), ACodec: NVIDIA Audio Decoder

04.07.10 17:20:58.609 VCodec CyberLink Video/SP Decoder (PDVD9)

04.07.10 17:20:58.656 ACodec NVIDIA Audio Decoder

04.07.10 17:20:59.140 AddVideoRenderer Add VMR 9

04.07.10 17:21:00.171 Used Filter 0: VMR 9 Renderer

04.07.10 17:21:00.171 Used Filter 1: DirectSound: Realtek HD Audio output

04.07.10 17:21:00.171 Used Filter 2: DVBV OSD-Source

04.07.10 17:21:00.171 Used Filter 3: NVIDIA Audio Decoder

04.07.10 17:21:00.171 Used Filter 4: CyberLink Video/SP Decoder (PDVD9)

04.07.10 17:21:00.171 Used Filter 5: DVB Source

04.07.10 17:21:02.046 Gotstr SIG 100

04.07.10 17:21:03.671 Sendstr UNSETTUNER 0 482000 6875 0 0 3 3 0 4403 4147 307 1012 0 0 0 25 0 45 40999

04.07.10 17:21:03.671 Sendstr DELPID 4147 4403 0 307 7987

04.07.10 17:21:03.718 TfrmMain Release Unicast Network Device

04.07.10 17:21:03.718 TfrmMain Destroy Unicast Network Device

04.07.10 17:21:03.718 Sendstr DELPID 18

04.07.10 17:21:03.718 TUCStreamThread Sessionended

04.07.10 17:21:03.718 TWSocketThread Sessionended

04.07.10 17:21:03.718 Powermessage PBT_APMQUERYSTANDBY

Edited by majstang
Link to comment

Hi Lars!

 

Would like to hear your opinion about this. Is it a inconsistency of DVBViewer...maybe this topic belongs in Bug Reports/DVBV beta? And most intresting of all, at least for me, is it fixable? :)

 

Regards

majstang

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...