Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Laptop Lid
#1
I'm having some problems with my laptop.  It keeps going into Hibernate mode for 'no' reason.
It is set to hibernate when the lid is closed so I'm thinking maybe the switch or sensor is bad and it's telling the laptop that the lid is closed when it's not.

is there a way in qm to trigger off of a lid closed event or to have it look into the a log for one?
An old blog on QM coding and automation.

The Macro Hook
#2
Function lid_close_open_triggers
Trigger @1     Help - how to add the trigger to the macro
Code:
Copy      Help
;stop if started second thread
if getopt(nthreads)>1
,clo win("lid_close_open_triggers" "#32770")
,ret

str dd=
;BEGIN DIALOG
;0 "" 0x90C80AC8 0x0 0 0 224 136 "lid_close_open_triggers"
;1 Button 0x54030001 0x4 116 116 48 14 "OK"
;2 Button 0x54030000 0x4 168 116 48 14 "Cancel"
;END DIALOG
;DIALOG EDITOR: "" 0 "*" "" "" ""

if(!ShowDialog(dd &sub.DlgProc 0 0 128)) ret


#sub DlgProc
function# hDlg message wParam lParam

type __POWERBROADCAST_SETTING5219 GUID'PowerSetting DataLength Data

sel message
,case WM_INITDIALOG
,int-- t_isLidOpen=1
,int-- t_h=RegisterPowerSettingNotification(hDlg GUID_LIDSWITCH_STATE_CHANGE DEVICE_NOTIFY_WINDOW_HANDLE)
,if(t_h=0) end ERR_FAILED
,
,case WM_DESTROY
,UnregisterPowerSettingNotification t_h
,
,case WM_POWERBROADCAST
,sel wParam
,,case PBT_POWERSETTINGCHANGE
,,__POWERBROADCAST_SETTING5219& x=+lParam
,,if !memcmp(&x.PowerSetting GUID_LIDSWITCH_STATE_CHANGE sizeof(GUID))
,,,if x.Data!=t_isLidOpen
,,,,t_isLidOpen=x.Data
,,,,out _s.timeformat(F"Lid {iif(x.Data `opened` `closed`)} at {{TT}.")
,,,,
,,,,;if !t_isLidOpen ;;lid closed
,,,,,;mac "lid closed"
,,
,,case PBT_APMSUSPEND
,,out _s.timeformat("Suspended at {TT}.")
,,
,,case PBT_APMRESUMEAUTOMATIC
,,out _s.timeformat("Resumed at {TT}.")
,,
,,case PBT_APMRESUMESUSPEND
,,out _s.timeformat("User-resumed at {TT}.")
,,
,,case else
,,out _s.timeformat(F"{wParam} at {{TT}.")
,
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case IDOK
,case IDCANCEL
ret 1
#3
WOW!!!  works great!!!  thanks so much!
An old blog on QM coding and automation.

The Macro Hook


Forum Jump:


Users browsing this thread: 1 Guest(s)