Hi,
I'm trying to modify the MobileSecretary code (by Brian Cross, available here: http://www.wimobot.com/wmapps/mobilesecretary/) to automatically answer to unread messages instead of incoming calls. I test my application (called VirtualSecretary) with VS 2005 device emulator (Phone PC with CF2.0).
I get the following error message when a SMS is received:
StateException
A registry key needs to be defined first before events are registered
at Microsoft.WindowsMobile.Status.RegistryState.GetRootAndSubkey()
at Microsoft.WindowsMobile.Status.RegistryState.RegisterTransient()
at Microsoft.WindowsMobile.Status.RegistryState.add_changed()
at VirtualSecreatary.MissedCallForm.MissedCall_Load()
at System.Windows.Forms.Form.OnLoad()
at System.Windows.Forms.Form._SetVisibleNotify()
at System.Windows.Forms.Control.set_Visible()
at System.Windows.Forms.Application.Run()
at VirtualSecretary.MainForm.Main()
Here are some information on the code itself so you can get an idea of what is going on.
The application is called a first time and signs up for unread sms events like this
missedCall.EnableApplicationLauncher(VirtualSecretary.MissedCallIdName, path, "-notification");
When the sms arrives, the VirtualSecretary is called with the -notification parameter. The Main for the application is
static void Main(string[] args)
{
if (args.Length == 1 && args[0] == "-notification")
{
Application.Run(new MissedCallForm());
}
else
{
Application.Run(new MainForm());
}
}
As you can see, the missedCallForm is called, the missedcallform starts as follows
private void MissedCall_Load(object sender, EventArgs e)
{
missedCallNotification = new SystemState(VirtualSecretary.MissedCallIdName);
missedCallNotification.Changed += new ChangeEventHandler(missedCallNotification_Changed);
etc etc
I've commented everything out to try to know where the exception occured and it seems to occur right at the beginning.
Can anybody help me out understanding what is going on
Thanks a lot

StateException
Majid.vagheeian
It appears that this question can better be answered by someone on one of the newsgroups for Windows Mobile or Windows CE. In order to get a quicker and more accurate response, please consider reposting this question to one of the following newsgroups:
Windows Mobile API:
microsoft.public.pocketpc.developer
microsoft.public.smartphone.developer
Windows CE API:
microsoft.public.windowsce.embedded
General programming (not VisualStudio related):
microsoft.public.windowsce.app.development
Native compilers:
microsoft.public.windowsce.embedded.vc
ActiveSync:
microsoft.public.pocketpc.activesync