Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / Compact Framework / February 2005

Tip: Looking for answers? Try searching our database.

Help Creating A Scheduled Task

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
MDB - 07 Feb 2005 19:12 GMT
Hello All,  I really need help creating a scheduled task.  I have tried
using CeRunAppAtTime and CeSetUserNotificationEx however have not had any
luck.  The problem is that it does work however, it is very inconsistent.
One day, 90% of the devices with run the task and then one day only 20% will
run it.  Can anyone point me in the right direction or recommend anything.
Basically what I am doing is having a application run every day at 5:00 am
to get any updates for my main application.

Thanks In Advance
Alex Feinman [MVP] - 08 Feb 2005 01:52 GMT
CeRunAppAtTime generally works. One reason it may fail for you (and I'm
shooting in the dark since you have not provided much details) is that if
the application being launched is a CF application and it was already
running in the background, the second copy will not be launched. Instead an
existing one will attempt to go into foreground

Signature

Alex Feinman
---
Visit http://www.opennetcf.org

> Hello All,  I really need help creating a scheduled task.  I have tried
> using CeRunAppAtTime and CeSetUserNotificationEx however have not had any
[quoted text clipped - 5 lines]
>
> Thanks In Advance
MDB - 08 Feb 2005 11:56 GMT
It is a CF application however, it is not the same one.  I have one main
application that is used, everytime this application is started, it calls
the usernotifications.runapplicationtion that I found here:

http://samples.gotdotnet.com/quickstart/CompactFramework/doc/notifications.aspx

Here is how I call it:

string path;
path =
System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase
);

//First reset task time
DateTime dtNextRunTime =
Convert.ToDateTime(DateTime.Now.AddDays(1).ToShortDateString() + "
05:00AM");
MyApp.Classes.UserNotifications.RunApplication(path +
"\\FTPTask.exe","",dtNextRunTime);

All my FTPTask.exe does is set a Token File and then warm boots the device
to clear everything out of memory.  Then when the main application starts
up, it looks for this token file.

Here is what my FTPTask.exe looks like:

static void Main()
{
string path;
path =
System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase
);
File.Create(path + "\\update\\FTP.tok");

Rebootapi reboot = new Rebootapi();
reboot.SoftReset();
}

private void Form1_Load(object sender, System.EventArgs e)
{

}

public class Rebootapi
{
[DllImport("Coredll.dll")]
extern static int KernelIoControl(
 int dwIoControlCode,
 IntPtr lpInBuf,
 int nInBufSize,
 IntPtr lpOutBuf,
 int nOutBufSize ,
 ref int lpBytesReturned );

[DllImport("Coredll.dll")]
extern static void SetCleanRebootFlag();

public void SoftReset()
{
 int IOCTL_HAL_REBOOT = 0x101003C;
 int bytesReturned = 0;

 // Do not use SetCleanRebootFlag()
 KernelIoControl(
  IOCTL_HAL_REBOOT,
  IntPtr.Zero,
  0,
  IntPtr.Zero,
  0,
  ref bytesReturned );
}
}

Any ideas?  Although I am setting this by calling the
CeSetUserNotificationEx (though usernotifications.runapplicationtion ) could
something be clearing it out of memory after I set it?

> CeRunAppAtTime generally works. One reason it may fail for you (and I'm
> shooting in the dark since you have not provided much details) is that if
[quoted text clipped - 11 lines]
>>
>> Thanks In Advance

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.