SYSTEMTIME in VB.NET

T

Thomas

OK, one other (hopefully final) upgrade issue here...

To run an app at a certain time, it was fairly easy in VB6...
see http://www.pocketpcdn.com/articles/cerunappattime.html

Now, in trying to upgrade my code to .NET, I'm having difficulty in
converting a time that will work correctly with CeRunAppAtTime ... I
have a feeling either it doesn't work right under .NET CF, or I'm not
converting the numbers properly...

What is the proper way to pass a systemtime to this function?

Thanks,
Tom
 
T

Thomas

Hi Again Peter,

I'm struggling quite a bit with understanding the types in .NET,
especially with a VB background. I can't seem to get the
CeRunAppAtTime to ever work, and I believe it's in my code as the
method call always returns false. All I'm doing is getting the
current date, adding 2 minutes, then getting the systemtime value.

Do you know of any examples (or possibly spit one out if you've done
this before) that execute the CeRunAppAtTime (pref. in vb.net or C#)?

Thank you very much for your help, it is appreciated.

Tom
 
T

Thomas

Actually, I think this is an example of sleep deprived stupidity (I
need to blame it on something). I just read the _second_ half of your
reply, re: P/Invoke, and will try this... I'm not sure what the
behavior is in the emulator, so reliable testing may need to wait
until tonite.

-Tom
 
P

Peter Foot [MVP]

That's an interesting point and the answer is I'm not sure this will work
with the current implementation - we convert the date time to a systemtime
internally - and the current code does not support passing in null. I will
make sure this is updated for our next update.
You could try passing DateTime.MinValue or a date in the past though I'm not
sure this will work.
Alternatively add the following P/Invoke code to the API call passing in
null to the time argument. (C#)
[DllImport("coredll", EntryPoint="CeRunAppAtTime", SetLastError=true)]

internal static extern int CeRunAppAtTime(string pwszAppName, byte[]
lpTime);

Which you can call like:-

CeRunAppAtTime("\\Program Files\\YourApp\\YourApp.exe", null);


Peter

--
Peter Foot
Windows Embedded MVP

In The Hand
http://www.inthehand.com
 

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