CoCreateInstance Failure

From: Bruce Roberts (ber_at_bounceitattcanada.xnet)
Date: 03/17/05

  • Next message: jehender_at_hotmail.com: "Put/Get in Delphi"
    Date: Thu, 17 Mar 2005 16:32:18 -0500
    
    

    I've got two programs C and D. Both of them are designed to be run by the
    Windows task scheduler. I wrote C first. Using the TaskScheduling units
    available at JEDI I added a configuration interface in the program to the
    scheduler. So when the program is configured, it can be scheduled. All works
    well. So I cut and pasted the relavent code from C to D. When I try it in D,
    on the same station, I get an "unexpected error". I wouldn't mind some
    suggestions as to where I should be looking. Better yet, a solution would be
    most welcome :).

    var iScheduler : iTaskScheduler;
         iItem : iTask;
         rslt : hResult;
         piTask : iUnknown;
         swItem : iScheduledWorkItem;
         piPersistFile : iPersistFile;
         pWChar2,
         pWChar : pWideChar;
         iTrigger : iTaskTrigger;
         StartAtHour,
         StartAtMinute,
         piTrigger,
         trigCount : word;
         Trigger : tTaskTrigger;
    . . .
    begin
    GetMem (pWChar, 1024);
    GetMem (pWChar2, 1024);
    try
         if StartScheduler <> error_Success
         then raise Exception.Create ('Unable to initiate TaskScheduler');
         rslt := ActiveX.CoCreateInstance (clsid_CSchedulingAgent, nil,
    clsctx_InProc_Server,
                                           iid_iTaskScheduler, iScheduler);
         if rslt <> s_Ok
         then ShowMessage ('Error in coCreateInstance (' + IntToHex (rslt, 8) +
    '). ' + xErrMsg (rslt))
         else begin
    . . .

    The message generated is always
            Error in coCreateInstance (800401F0). Unexpected error

    StartScheduler is from the JEDI support unit.


  • Next message: jehender_at_hotmail.com: "Put/Get in Delphi"