internal static extern bool CeRunAppAtTime(string pwszAppName, ref SYSTEMTIME lpTime);
internal static extern int CeSetUserNotification(int hNotification, string pwszAppName, ref SYSTEMTIME lpTime, UserNotification lpUserNotification);
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"); } }