Windows task won't trigger..

This is a discussion on Windows task won't trigger.. within the Windows Programming forums, part of the Platform Specific Boards category; Hi. I'm creating a new task in XP using the following code. Code: NewWorkItem() SetApplicationName() SetParameters() SetWorkingDirectory() SetAccountInformation() CreateTrigger() TASK_TRIGGER ...

  1. #1
    Registered User
    Join Date
    Feb 2002
    Posts
    329

    Windows task won't trigger..

    Hi.
    I'm creating a new task in XP using the following code.
    Code:
    NewWorkItem()
    SetApplicationName()
    SetParameters()
    SetWorkingDirectory()
    SetAccountInformation()
    CreateTrigger()
    TASK_TRIGGER pTrigger;
      ZeroMemory(&pTrigger, sizeof(TASK_TRIGGER));
      pTrigger.wBeginDay =1;                  // Required
      pTrigger.wBeginMonth =1;                // Required
      pTrigger.wBeginYear =1999;              // Required
      pTrigger.cbTriggerSize = sizeof (TASK_TRIGGER); 
      pTrigger.wStartHour = chTime;
      pTrigger.TriggerType = TASK_TIME_TRIGGER_DAILY;
      pTrigger.Type.Daily.DaysInterval = 1;
    SetTrigger(&pTrigger)
    QueryInterface(IID_IPersistFile, (void **)&pIPersistFile);
    pIPersistFile->Save
    this works well, and the task is created, but it doesn't run...
    Am i missing something??

    Edit:
    I shortened the code a bit, as there's alot of error handling/data formatting for each step..
    Last edited by knutso; 12-02-2004 at 01:16 AM.

  2. #2
    Yes, my avatar is stolen anonytmouse's Avatar
    Join Date
    Dec 2002
    Posts
    2,544
    As far as I can see, your pseudo-code looks fine. Are you sure that the path is valid? Can you see any differences on the property page for a task created programmatically compared to one created manually? Do all method calls succeed? Is the account information valid?

  3. #3
    Registered User
    Join Date
    Feb 2002
    Posts
    329
    Hi, and thanks for the reply.
    It seems there was a problem with the account info, so i now use the system account.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Just starting Windows Programming, School me!
    By Shamino in forum Windows Programming
    Replies: 17
    Last Post: 02-22-2008, 07:14 AM
  2. how to make a windows application
    By crvenkapa in forum C++ Programming
    Replies: 3
    Last Post: 03-26-2007, 09:59 AM
  3. Question..
    By pode in forum Windows Programming
    Replies: 12
    Last Post: 12-19-2004, 06:05 PM
  4. SDL and Windows
    By nickname_changed in forum Windows Programming
    Replies: 14
    Last Post: 10-24-2003, 12:19 AM
  5. IE 6 status bar
    By DavidP in forum Tech Board
    Replies: 15
    Last Post: 10-23-2002, 05:31 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21