public static int SetUserNotification(int handle, string application, DateTime time, UserNotification notify) { SYSTEMTIME lpTime = SYSTEMTIME.FromDateTime(time); int num = NativeMethods.CeSetUserNotification(handle, application, ref lpTime, notify); if (num == 0) { throw new Win32Exception(Marshal.GetLastWin32Error(), "Error setting UserNotification"); } return(num); }
public static void RunAppAtTime(string appName, DateTime time) { SYSTEMTIME lpTime = new SYSTEMTIME(); if (time != DateTime.MinValue) { lpTime = new SYSTEMTIME(); lpTime = SYSTEMTIME.FromDateTime(time); if (!NativeMethods.CeRunAppAtTime(appName, ref lpTime)) { throw new Win32Exception(Marshal.GetLastWin32Error(), "Cannot Set Notification Handler"); } } else if (!NativeMethods.CeRunAppAtTimeCancel(appName, null)) { throw new Win32Exception(Marshal.GetLastWin32Error(), "Cannot Cancel Notification Handler"); } }