Solved

Need help deciphering the parameters for the function 'NetScheduleJobAdd()'

Posted on 2001-06-14
5
354 Views
Last Modified: 2008-01-16
Greetings:

The second parameter for NetScheduleJobAdd() is a structure of type 'AT_INFO' which is defined as:

typedef struct _AT_INFO {
    DWORD   JobTime;
    DWORD   DaysOfMonth;
    UCHAR   DaysOfWeek;
    UCHAR   Flags;
    LPWSTR  Command;
} AT_INFO, *PAT_INFO, *LPAT_INFO;

My question is, what is necessary to initialize this structure before it is used in the NetScheduleJobAdd function?  This structure is contained in the second parameter below:

NetScheduleJobAdd( LPWSTR Servername,  LPBYTE Buffer,   LPDWORD JobId);
 
 
0
Comment
Question by:John500
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 5

Expert Comment

by:proskig
ID: 6190825
Remarks
Following are examples of how to schedule jobs using different properties supported by the NetScheduleJobAdd function.

To schedule a job that executes once

Set the DaysOfMonth member of the AT_INFO structure to zero.
Set the DaysOfWeek member to zero.
Set the JobTime member to the time the job should execute.
The job executes at the time specified by the JobTime member. After the job executes, it is deleted.

To schedule and delete a job that executes multiple times

Set the appropriate bits in the DaysOfMonth member of the AT_INFO structure.
Set the appropriate bits in the DaysOfWeek member. (You do not need to set both the DaysOfMonth and the DaysOfWeek members.)
Set the JobTime member to the time the job should execute.
The job executes at the time specified by the JobTime member, once for each day set in DaysOfMonth and DaysOfWeek. After each execution, the corresponding bit is cleared. When the last bit is cleared, the job is deleted.

To schedule a job that executes periodically

Set the appropriate bits in the DaysOfMonth member of the AT_INFO structure.
Set the appropriate bits in the DaysOfWeek member. (You do not need to set both the DaysOfMonth and the DaysOfWeek members.)
Set the JobTime member to the time the job should execute.
Set the job submission flag JOB_RUN_PERIODICALLY in the Flags member.
The job will execute periodically, at the time specified by the JobTime member, on each day set in DaysOfMonth and DaysOfWeek. The job will not be deleted as a result of the repeated executions. The only way to delete the job is by an explicit call to the NetScheduleJobDel function.

See AT_INFO for a description of the DaysOfWeek, DaysOfMonth, and job property bitmasks.

0
 

Author Comment

by:John500
ID: 6190991
proskig,

Thanks for the response.  I have MSDN and have read it a number of times regarding this function.  However, I still don't understand how to 'set' all of the things you mention.

In other words, it would be helpful to see code which shows the 'AT_INFO' structure actually being set.  Do you get my point?
0
 
LVL 3

Accepted Solution

by:
gmleeman earned 50 total points
ID: 6191394
Hi There

Use your code as is:

typedef struct _AT_INFO {
   DWORD   JobTime;
   DWORD   DaysOfMonth;
   UCHAR   DaysOfWeek;
   UCHAR   Flags;
   LPWSTR  Command;
} AT_INFO, *PAT_INFO, *LPAT_INFO;


Then in your code:

int main(void)
{
   char ascOther[80];
   AT_INFO myATINFO;

   myATINFO.DaysOfMonth = 0;
   myATINFO.DayOfWeek = 0;

   function(&myATINFO);

}

The above shows how to initialise two elements of the stucture, and to pass the variable as a pointer to a function.

The type AT_INFO can be treated now as "int" or "char".
(The *PAT_INFO, *LPAT_INFO could be a bit confusing...)



Hope this helps
0
 
LVL 30

Expert Comment

by:Axter
ID: 6191420
Hi gmleeman,
All of the experts here, for the most part have learn from other experts as to the proper etiquette
for posting answer.
 An answer should not be posted as an answer, if other experts have previously posted possible answers
as comments, and/or have already made contributions to the question.

There are many experts who never post answers as answer.  Instead, they post their answers as comments.
If you read the following link, you?ll see why this is the preferred method for many of our valued experts,
including myself.

http://www.experts-exchange.com/jsp/cmtyQuestAnswer.jsp


Hi John500,
Feel free to click the [Reject Answer] button near (Answer-poster's) response, even if it seems like
a good answer.
Doing so will increase your chance of obtaining additional input from other experts.  Later, you can
click the [Select Comment as Answer] button on any response.
0
 

Author Comment

by:John500
ID: 6191472
gmleeman,

Thanks, that's definately the answer.  I should have thought of that!!

I can post another question if you like, otherwise, do you happen to know whether this function would run for, say, 2 days by vurtue of how the 'members' are set.

In other words if the main() looks like this:

main()
{

{
  char ascOther[80];
  AT_INFO myATINFO;

  myATINFO.DaysOfMonth = 2;
  myATINFO.DayOfWeek = 1;
  myATINFO.Flag = JOB_RUN_PERIODICALLY;

  NetScheduleJobAdd(server, buffer, JobId)


 return;
}

 ... regardless of whether the members are set correctly, I just want to know whether this program is capable of running for 2 days before quitting?

Thanks
0

Featured Post

[Live Webinar] The Cloud Skills Gap

As Cloud technologies come of age, business leaders grapple with the impact it has on their team's skills and the gap associated with the use of a cloud platform.

Join experts from 451 Research and Concerto Cloud Services on July 27th where we will examine fact and fiction.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
This article will show you some of the more useful Standard Template Library (STL) algorithms through the use of working examples.  You will learn about how these algorithms fit into the STL architecture, how they work with STL containers, and why t…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

615 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question