Microsoft Internet Security and Acceleration Server 2000

Adding a Schedule Using C++

The following is a portion of C++ code that adds a new schedule called "Extended Work Hours", which includes all hours on all days. This code was written as a Windows Console Application. To use this code:

  1. In Visual C++, create a new Win32 Console Application.
  2. Select the default empty project.
  3. Create a new C++ source file in the workspace.
  4. Paste the following code into the C++ source file, and build the project.
    //Import the ISA msfpccom.dll file so that ISA COM objects can be used.
    //Use the path to your ISA installation directory, or search for msfpccom.idl
    #import "d:\Program Files\Microsoft ISA Server\msfpccom.dll"
    int main ()
    // Define variables.
    HRESULT hr;
    //Initialize the COM library on the current thread.
    hr = CoInitialize( NULL ); 
    // Define variables.
    FPCLib::IFPCPtr sipFPCRoot;
    FPCLib::IFPCSchedulesPtr sipMyScheduleCol;
    FPCLib::IFPCSchedulePtr sipMySchedule;
    // Create the ISA root object.
    hr = sipFPCRoot.CreateInstance("FPC.Root");
    //Get the schedules collection.
    sipMyScheduleCol = sipFPCRoot->Arrays->GetContainingArray()->PolicyElements->Schedules;
    //Add the schedule.
    sipMySchedule = sipMyScheduleCol->Add("My New Schedule");
    //Set the schedule
    sipMySchedule->Set(FPCLib::fpcALL_WEEK, FPCLib::fpcALL_DAY);
    //Save your changes.
    return 0;
  5. Run the application.

See Also

FPCSchedule, Modify a Schedule