Hello,
I am using:
Visual Studio 2008, C#
..net Compact Framework 3.5
Mobile 6 SDK
Mobile 6 device
My code compiles fine.
When I test the code with the event set to 3(ac On) or 4(ac Off) nothing
happens when I plug/unplug the power cord.
When I test the code with the event set to 1(time change) it works fine when
I change the date.
Am I doing something wrong???
Any help would be GREATLY appreciated.
Thanks,
Tia
[DllImport("CoreDLL.dll")]
public static extern bool CeRunAppAtEvent(string application, int
EventID);
[DllImport( "coredll.dll" )]
private static extern IntPtr CeSetUserNotificationEx( IntPtr
notification, CE_NOTIFICATION_TRIGGER notificationTrigger,
CE_USER_NOTIFICATION userNotification );
[StructLayout(LayoutKind.Sequential)]
private struct SYSTEMTIME
{
[MarshalAs(UnmanagedType.U2)]
public short Year;
[MarshalAs(UnmanagedType.U2)]
public short Month;
[MarshalAs(UnmanagedType.U2)]
public short DayOfWeek;
[MarshalAs(UnmanagedType.U2)]
public short Day;
[MarshalAs(UnmanagedType.U2)]
public short Hour;
[MarshalAs(UnmanagedType.U2)]
public short Minute;
[MarshalAs(UnmanagedType.U2)]
public short Second;
[MarshalAs(UnmanagedType.U2)]
public short Milliseconds;
public SYSTEMTIME(DateTime dt)
{
dt = dt.ToUniversalTime(); // SetSystemTime expects the
SYSTEMTIME in UTC
Year = (short)dt.Year;
Month = (short)dt.Month;
DayOfWeek = (short)dt.DayOfWeek;
Day = (short)dt.Day;
Hour = (short)dt.Hour;
Minute = (short)dt.Minute;
Second = (short)dt.Second;
Milliseconds = (short)dt.Millisecond;
}
}
private class CE_NOTIFICATION_TRIGGER
{
public UInt32 Size = 0;
public UInt32 Type = 0;
public UInt32 Event = 0;
[MarshalAs(UnmanagedType.LPWStr)]
public string pAppName;
[MarshalAs(UnmanagedType.LPWStr)]
public string pArgs;
public SYSTEMTIME StartTime;
public SYSTEMTIME EndTime;
}
private class CE_USER_NOTIFICATION
{
public UInt32 ActionFlags;
[MarshalAs(UnmanagedType.LPWStr)]
public string pDialogTitle;
[MarshalAs(UnmanagedType.LPWStr)]
public string DialogText;
[MarshalAs(UnmanagedType.LPWStr)]
public string Sound;
public UInt32 MaxSound;
public UInt32 Reserved;
}
|