How to get the next alarm time/day?

J

juvi

Hello,

How can I get the next alarm time and day?
Is this possible with the .net cf?

thx in advance.

BR,
juvi
 
C

Chris Tacke, eMVP

Call the following:

CeGetUserNotificationHandles
CeGetUserNotification (twice - once to get the size and again to get the
data)


--

Chris Tacke, Embedded MVP
OpenNETCF Consulting
Giving back to the embedded community
http://community.OpenNETCF.com
 
J

juvi

thx for your reply.

I am running into troubles when trying to implement this:

I tried to P/Invoke CeGetUserNotificationHandles but I cannot get it work. I
would only need the information if there is an active alarm or not.

Because I am not so familiar in converting c++ to c# code I hope that you
can send me a simple way to achive this.

thx
juvi
 
C

Chris Tacke, eMVP

You "tried" how? Show us your code. I don't have anything just lying
around that does exactly what you want. I'm sure the SDF has these
P/Invokes defined, but in either case, you're going to have to help us help
you.


--

Chris Tacke, Embedded MVP
OpenNETCF Consulting
Giving back to the embedded community
http://community.OpenNETCF.com
 
J

juvi

I used this P/Invoke from www.pinvoke.net:

[DllImport("coredll.dll", EntryPoint="CeGetUserNotificationHandles",
SetLastError=true)]
private static extern bool CeGetUserNotificationHandles(IntPtr[]
rghNotifications, uint cHandles, ref uint pcHandlesNeeded);

in my code I tried to use:

int res;
CeGetUserNotificationHandles(null, 0, out res);

IntPtr[] handles = new IntPtr[res];
CeGetUserNotificationHandles(handles, res, out res);


foreach (IntPtr h in handles)
{
// no idea what to do here
}

This code is running into syntax error - there must be something wrong.

juvi
 
C

Chris Tacke, eMVP

Well the syntax error is likely telling you what's wroing (and I'm sure it
has to do with you trying to pass an out parameter to a method that's
expecting a ref. I'm not going to give you the answer here. This is pretty
basic development and you have enough info that a search engine will get you
to the answer. You need to _understand_ code, not just be able to paste it
together to get better at what you do. Me giving you the answer will teach
you nothing.

Once you fix the syntax error, I'd also poitn out that the call returns a
boolean for a reason, not just becasue the API developer thought it would be
fun. You might want to actually use that value for something.

In your "no idea what to do here" section, I'd recommend looking at the
documentation for the two APIs I named. While the docs aren't specifically
for managed code, the logic on how they're used is the same in any language.


--

Chris Tacke, Embedded MVP
OpenNETCF Consulting
Giving back to the embedded community
http://community.OpenNETCF.com


juvi said:
I used this P/Invoke from www.pinvoke.net:

[DllImport("coredll.dll", EntryPoint="CeGetUserNotificationHandles",
SetLastError=true)]
private static extern bool CeGetUserNotificationHandles(IntPtr[]
rghNotifications, uint cHandles, ref uint pcHandlesNeeded);

in my code I tried to use:

int res;
CeGetUserNotificationHandles(null, 0, out res);

IntPtr[] handles = new IntPtr[res];
CeGetUserNotificationHandles(handles, res, out res);


foreach (IntPtr h in handles)
{
// no idea what to do here
}

This code is running into syntax error - there must be something wrong.

juvi

Chris Tacke said:
You "tried" how? Show us your code. I don't have anything just lying
around that does exactly what you want. I'm sure the SDF has these
P/Invokes defined, but in either case, you're going to have to help us
help
you.


--

Chris Tacke, Embedded MVP
OpenNETCF Consulting
Giving back to the embedded community
http://community.OpenNETCF.com
 
J

juvi

OK, I was not able to do this with my first method.

I saw that the OpenNetCF has also the ability to get the notifications, so I
referenced the OpenNetCF.WindowsCE and tried to do the following:

UserNotificationInfoHeader unih = null;
int[] alarmHandles = Notify.GetUserNotificationHandles();
if (alarmHandles.Length > 0)
{
unih = Notify.GetUserNotification(alarmHandles[0]);
}

What is now needed to get the information if there is an active alarm or
not? I want to understand this really, but now I need this urgently - I will
look into this, I guarantee. Please help me.....juvi
 
J

juvi

Hmmm...this was not the right solution for my problem so I searched the
registry and found a value indicating for active alarm .... but thanks anyway

juvi
 

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