Guest rogueqd Posted March 24, 2006 Report Posted March 24, 2006 Yay, it works (or at least it does for me). Allows you to browse for a sound file, so you can specify one on your mini-sd card. Comments would be appreciated. EddieSetAlarm.zip
Guest othoca Posted March 27, 2006 Report Posted March 27, 2006 (edited) You have done a good job!!! In which language have u developed it? using the cf 2.0? is it possible to have the source code too? Thanks in advance Edited March 27, 2006 by othoca
Guest rogueqd Posted April 6, 2006 Report Posted April 6, 2006 I used CF2.0 with the OpenNetCF 1.4 registry code. I'm making a much improved version so I don't have the original source for this one anymore, but the interesting parts are: using OpenNETCF.Win32; private RegistryKey registryKey; private string soundKeyName = "ControlPanel\\Sounds\\Clock"; private string timeKeyName = "Software\\Microsoft\\Clock\\0"; private void ReadRegistry() { byte[] rBuff; registryKey = Registry.CurrentUser.CreateSubKey(soundKeyName); soundFile = (string)registryKey.GetValue("Sound"); if (registryKey.ValueCount == 3) { alarmScript = (string)registryKey.GetValue("Script"); } else { alarmScript = "ap"; } registryKey.Close(); registryKey = Registry.LocalMachine.CreateSubKey(timeKeyName); alarmState = (byte[])registryKey.GetValue("AlarmFlags"); if (alarmState == null) { alarmState = new Byte[1]; } rBuff = (byte[])registryKey.GetValue("AlarmTime"); if (rBuff != null) { alarmTime = Convert.ToInt32(rBuff[0]) + (256 * Convert.ToInt32(rBuff[1])); } registryKey.Close(); } private void WriteRegistry() { Byte[] rBuff = {0,0}; if (cboAlarmState.SelectedItem == "On") { alarmState[0] = 1; } else { alarmState[0] = 0; }; alarmTime = 0; alarmTime = alarmTime + dateTimePicker1.Value.Minute; alarmTime = alarmTime + (dateTimePicker1.Value.Hour * 60); while (alarmTime > 255) { rBuff[1]++; alarmTime = alarmTime - 256; } rBuff[0] = Convert.ToByte(alarmTime); alarmScript = "ap"; if (chkRepeat.Checked == true) { if (chkInterval.Checked == true) { alarmScript = alarmScript + "w3"; } alarmScript = alarmScript + "r"; } registryKey = Registry.CurrentUser.CreateSubKey(soundKeyName); registryKey.SetValue("Sound", soundFile); registryKey.SetValue("Script", alarmScript); registryKey.Close(); registryKey = Registry.LocalMachine.CreateSubKey(timeKeyName); registryKey.SetValue("AlarmFlags", alarmState); registryKey.SetValue("AlarmTime", rBuff); registryKey.Close(); } Hope that's not too messy for anyone. ;)
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now