Waking up device at specific time VB.NET

A

Andy Baker

Does anyone have any VB.NET code on how to use SetUserNotification to
wake up a device. I am using VB.NET 2003 and OPENNETCF 1.4. The code I am
trying to use is:
Notify = New OPENNETCF.Win32.Notify.UserNotification
nt = New OPENNETCF.Win32.Notify.UserNotificationTrigger
nt.Type = NotificationType.Event
nt.Event = NotificationEvent.Wakeup
nt.Application = Path & "Invoicing.exe"
nt.StartTime = dtTime
intNotificationHandle =
OPPENNETCF.Win32.Notify.Notify.SetUserNotification(nt, Notify)

but this gives me the error 'Error setting UserNotification'.
I am have seen examples in C#, but not being much of a C# programmer,
I don't really understand what is going on! What I actually want to do is
wake up the device during the night, perform some overnight processing, then
set another notification event to do the same thing on the next working day.
Am I going about it in the right way? Thanks in advance.

Andy Baker
 
P

Peter Foot [MVP]

You can't set an event and a time - NotificationEvent.Wakeup is used to
schedule a notification when the device wakes up, to launch at a particular
time set Type to NotificationType.Time and don't set the Event property.

Peter
 
A

Andy Baker

Thanks Peter - my code runs now. I'll find out whether it works tomorrow!

Andy Baker
 
A

Andy Baker

The waking up of the device now works fine, and the overnight processing,
but I have come across a strange problem. If I wake up the device overnight,
when I come to it in the morning my Activesync USB connection to my desktop
PC no longer works, and I have to hard reset my CE device to get it to work
again. Gotive, the manufacturers of my hardware device are telling me that
the OPENNETCF calls that I am using must be changing something in the
registry that is presenting Activesync from working. Does this sound
feasible, and if so, what can I do about it?

Andy Baker
 
G

Guest

The OEM is wrong. Notifications have nothing to do with ActiveSync or the
registry. The code you're using is the same that the calendar uses for
notifications. If you set a remonder in the calendar for overnight do you
see the same behavior?


--
Chris Tacke - Embedded MVP
OpenNETCF Consulting
Managed Code in the Embedded World
www.opennetcf.com
 
A

Andy Baker

That's what I suspected. The Gotive is running CE.NET , and I cannot find a
calendar application on it - should there be one? I will do some more
testing on this and see if I can get any closer to what is causing it.
Thanks for your advice.

Andy Baker
 
G

Guest

If it has no calendar, my next step would be to write a simple C
notification app and see if it behaves the same way.
 
A

Andy Baker

Hi Chris

I have a simple C++ notification app, supplied by Gotive, and it doesn't
behave the same way. It suspends the device, then wakes it up 30 seconds
later, and Activesync works OK each time. It must be my code.

Andy Baker
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top