Recently, I want to create a scenario, but simply implement three states: normal volume, vibration, and mute.
Originally, it would not be very difficult to think about such a simple one. If no relevant function is found at the beginning, the Registry changes will be captured to implement these three states.
The results can be implemented in these three states. Haha, I learned several useful registry items.
Hkcu/controlpanel/notifications/shelloverrides: mode. 0 indicates normal, 1 indicates vibration, 2 indicates mute
Hkcu/controlpanel/volume:
_ T ("key") // press the volume
_ T ("ringer") // THIS IS NOT CLEAR
_ T ("screen") // It should be the screen volume.
_ T ("volume") // system volume
Hkcu/controlpanel/soundcategories/ring: initvol this is the second column of the Adjustment Volume (0-5)
The volume backup value in the system status is saved in
Hkcu/controlpanel/notifications/shelloverrides:
_ T ("savedkey ")
_ T ("saveringer ")
_ T ("savedscreen ")
_ T ("savedvolume ")
The text in copy snapi. H also needs to be set in the phone.
//////////////////////////////////////// ////////////////////////////////////////
// Phoneringeroff
// Gets a value indicating whether the phone's ringer is off (I. e., if it rings and/or vibrates ).
# Define sn_phoneringeroff_root HKEY_LOCAL_MACHINE
# Define sn_phoneringeroff_path text ("system // state // phone ")
# Define sn_phoneringeroff_value text ("status ")
# Define sn_phoneringeroff_bitmask 0x40
//////////////////////////////////////// //////////////////////////////////
You can set the corresponding mode and volume to implement the corresponding functions, but the horn icon on the titlebar has not changed...
This problem is very depressing. Later I found two articles on the Internet, so I don't have to maintain the registry myself,
You can change the icon in the title bar above ~
Http://social.msdn.microsoft.com/Forums/zh-TW/803/thread/cb9786c0-823b-4bb1-9f54-12815695ae9c
Http://www.devdiv.com/thread-24092-1-1.html
Is to use the sndsetsound () function.
// Set the top column horn icon to (by jlzg) Open <br/> sndfileinfo sndfile1; <br/> token = snd_soundtype_on; <br/> sndsetsound (snd_event_all, & sndfile1, true); </P> <p> // set the top column horn icon to (by jjlzg) Vibration <br/> sndfileinfo sndfile2; <br/> sndfile2.ssttype = snd_soundtype_vibrate; <br/> sndsetsound (snd_event_all, & sndfile2, true );