c++ problems
c++ problems
I just bought the SA based on the perfect working demo in Delphi. But writing an application using the component in c++ gives some problems.
1. The Comments and the Parameters property of TaskScheduler return empty strings, whilst in delphi they return the proper strings.
2. Accessing scheduler xp properties whilst running vista raises exceptions
3. the taskdialog component does not function at all, it just returns, using the taskitem EditWorkItem gives a: interface not supported.
i didnt get yet to the point of trying other functions, as i got stuck already here.
platform: Vista x64 sp1 latest update
environment: Codegear RAD Studio 2007
tests also run in Virtual Box with XP 32 Host.
please advice
1. The Comments and the Parameters property of TaskScheduler return empty strings, whilst in delphi they return the proper strings.
2. Accessing scheduler xp properties whilst running vista raises exceptions
3. the taskdialog component does not function at all, it just returns, using the taskitem EditWorkItem gives a: interface not supported.
i didnt get yet to the point of trying other functions, as i got stuck already here.
platform: Vista x64 sp1 latest update
environment: Codegear RAD Studio 2007
tests also run in Virtual Box with XP 32 Host.
please advice
www.petrossa.com/errordemo.rar
for now it only shows that the parameters are not returned (at least on my system) . The other errors i'll add as time comes
for now it only shows that the parameters are not returned (at least on my system) . The other errors i'll add as time comes
Thank you very much for your demo. There is just a little modification needed in your code in order to work properly:
Please note call of Activate() method and setting of CurrentAction (under Windows Vista). We will try to improve our code in order to auto-set CurrentAction to 1 when it is not set.
Please let us know if this helps.
Code: Select all
TTaskItem * TI = (TTaskItem *) Item->Data;
TI->Activate();
Memo1->Lines->Add(TI->Comment);
if (TaskScheduler1->RunningVistaOrLater()) {
TI->CurrentAction = 1;
}
Memo1->Lines->Add(TI->Parameters);
Please let us know if this helps.
Best regards,
Igor Siticov.
Igor Siticov.
Thank you for update. Unfortunately, TaskPropertiesDialog doesn't work under Windows Vista (when using Task Scheduler 2 interface), because Task Scheduler 2.0 doesn't provide this functionality. You can link Delphi unit Prop.pas into your C++ project and use it to display task properties dialog. There is only needed to use
function from the Props.pas unit to display and edit Task Properties.
Code: Select all
PropertiesDlg()
function from the Props.pas unit to display and edit Task Properties.
Best regards,
Igor Siticov.
Igor Siticov.
building props.pas as c++ package gives:
[ILINK32 Error] Error: Unresolved external '__fastcall Satask::TTaskItem::GetTaskDefinition()' referenced from C:\USERS\DOCUMENTS\RAD STUDIO\PROJECTS\DEBUG_BUILD\PROPS.OBJ
[ILINK32 Error] Error: Unresolved external '__fastcall Sautils::IsUserAnAdmin()' referenced from C:\USERS\DOCUMENTS\RAD STUDIO\PROJECTS\DEBUG_BUILD\PROPS.OBJ
i only added props.pas to the package, do i need to add more files to get the build?
[ILINK32 Error] Error: Unresolved external '__fastcall Satask::TTaskItem::GetTaskDefinition()' referenced from C:\USERS\DOCUMENTS\RAD STUDIO\PROJECTS\DEBUG_BUILD\PROPS.OBJ
[ILINK32 Error] Error: Unresolved external '__fastcall Sautils::IsUserAnAdmin()' referenced from C:\USERS\DOCUMENTS\RAD STUDIO\PROJECTS\DEBUG_BUILD\PROPS.OBJ
i only added props.pas to the package, do i need to add more files to get the build?
well i got it going at last. Took some puzzling however. You might consider looking into the C++ integration a bit.
First i changed the *.h includes added by the shedagent component for the *.hpp from the base Source directory. The codegear source files have no declaration for the missing functions.
Then i recompiled the schedagent package using strict c++ settings, replaced the component in the IDE and now it links (and works) well.
First i changed the *.h includes added by the shedagent component for the *.hpp from the base Source directory. The codegear source files have no declaration for the missing functions.
Then i recompiled the schedagent package using strict c++ settings, replaced the component in the IDE and now it links (and works) well.
I put a sort of parallel to your demo together. Rough still. Would you mind looking at www.petrossa.com/test.rar ?
Under xp the task create function works perfect. Under vista however i get an exception thrown: specified file not found. This happens after this function is called in your CreateNewTaskWizard:
FTask := FTaskScheduler.ActivateTask(wsName);
if you continue, you get an Out of Bounds exception, if you continue still the task is created anyway, but the taskname is added to the parameters.
Entering the function in the debugger quickly gets you lost in the system library.
Yo have an idea?
Under xp the task create function works perfect. Under vista however i get an exception thrown: specified file not found. This happens after this function is called in your CreateNewTaskWizard:
FTask := FTaskScheduler.ActivateTask(wsName);
if you continue, you get an Out of Bounds exception, if you continue still the task is created anyway, but the taskname is added to the parameters.
Entering the function in the debugger quickly gets you lost in the system library.
Yo have an idea?
1. "Unable to locate task" is "internal" exception and it is not visible when running without debugger. You can just ignore it.
2. We cannot reproduce "Out of bounds" exception on our Demo project.
3. Task name added to the parameters because this is how our Demo project is designed. You can see this in the code:
2. We cannot reproduce "Out of bounds" exception on our Demo project.
3. Task name added to the parameters because this is how our Demo project is designed. You can see this in the code:
Code: Select all
if edtApplicationName.Text = Application.ExeName then
FTask.Parameters := edtParameters.Text + ' ' + wsName
else
FTask.Parameters := edtParameters.Text;
Best regards,
Igor Siticov.
Igor Siticov.