SiComponents Home Page SiComponents Forums
Here you will be able to get help and share your experience
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

c++ problems
Goto page 1, 2  Next
 
Post new topic   Reply to topic    SiComponents Forums Forum Index -> VCL Scheduling Agent
View previous topic :: View next topic  
Author Message
petrossa



Joined: 12 Aug 2008
Posts: 23

PostPosted: Wed Aug 13, 2008 5:58 am    Post subject: c++ problems Reply with quote

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
Back to top
View user's profile Send private message
isiticov
Site Admin


Joined: 21 Nov 2002
Posts: 2103

PostPosted: Wed Aug 13, 2008 8:53 am    Post subject: Reply with quote

Hello,

Could you please reproduce these problem on any sample project and send it to us to test? As you may notice Delphi and C++ use the same source of components and all these errors under C++ look very strange.
Back to top
View user's profile Send private message
petrossa



Joined: 12 Aug 2008
Posts: 23

PostPosted: Wed Aug 13, 2008 4:43 pm    Post subject: Reply with quote

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
Back to top
View user's profile Send private message
isiticov
Site Admin


Joined: 21 Nov 2002
Posts: 2103

PostPosted: Thu Aug 14, 2008 8:22 am    Post subject: Reply with quote

Thank you very much for your demo. There is just a little modification needed in your code in order to work properly:

Code:
TTaskItem * TI = (TTaskItem *) Item->Data;
TI->Activate();
Memo1->Lines->Add(TI->Comment);
if (TaskScheduler1->RunningVistaOrLater()) {
   TI->CurrentAction = 1;
}
Memo1->Lines->Add(TI->Parameters);

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.
Back to top
View user's profile Send private message
petrossa



Joined: 12 Aug 2008
Posts: 23

PostPosted: Thu Aug 14, 2008 11:32 am    Post subject: Reply with quote

that works Very Happy
Not really evident from the manual though. what does Activate do exactly, the manual is not very informative.

Would you be so kind and reload the demo? I added taskpropertiesdialog which i cant get to function
Back to top
View user's profile Send private message
isiticov
Site Admin


Joined: 21 Nov 2002
Posts: 2103

PostPosted: Thu Aug 14, 2008 12:17 pm    Post subject: Reply with quote

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
Code:
PropertiesDlg()

function from the Props.pas unit to display and edit Task Properties.
Back to top
View user's profile Send private message
petrossa



Joined: 12 Aug 2008
Posts: 23

PostPosted: Thu Aug 14, 2008 4:14 pm    Post subject: Reply with quote

ok. thanks for the prompt reply. You plan to to update the manual? It's very sparse.
Back to top
View user's profile Send private message
isiticov
Site Admin


Joined: 21 Nov 2002
Posts: 2103

PostPosted: Fri Aug 15, 2008 3:48 am    Post subject: Reply with quote

Surely, we will try to improve it.
Back to top
View user's profile Send private message
petrossa



Joined: 12 Aug 2008
Posts: 23

PostPosted: Fri Aug 15, 2008 10:47 am    Post subject: Reply with quote

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?
Back to top
View user's profile Send private message
isiticov
Site Admin


Joined: 21 Nov 2002
Posts: 2103

PostPosted: Fri Aug 15, 2008 11:19 am    Post subject: Reply with quote

I meant just add it to the C++ project itself not to the package. Also you would need to add SelectActions.pas unit and make small change in Prop.Pas:
Delete Main from the uses clause under implementation section.
Back to top
View user's profile Send private message
petrossa



Joined: 12 Aug 2008
Posts: 23

PostPosted: Fri Aug 15, 2008 11:36 am    Post subject: Reply with quote

ok, added to the project as units. Still gives same linker error.
Back to top
View user's profile Send private message
petrossa



Joined: 12 Aug 2008
Posts: 23

PostPosted: Sat Aug 16, 2008 11:23 am    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
petrossa



Joined: 12 Aug 2008
Posts: 23

PostPosted: Mon Aug 18, 2008 4:36 pm    Post subject: Reply with quote

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?
Back to top
View user's profile Send private message
isiticov
Site Admin


Joined: 21 Nov 2002
Posts: 2103

PostPosted: Tue Aug 19, 2008 10:45 am    Post subject: Reply with quote

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:
Code:

        if edtApplicationName.Text = Application.ExeName then
          FTask.Parameters := edtParameters.Text + ' ' + wsName
        else
          FTask.Parameters := edtParameters.Text;
Back to top
View user's profile Send private message
petrossa



Joined: 12 Aug 2008
Posts: 23

PostPosted: Tue Aug 19, 2008 11:15 am    Post subject: Reply with quote

tnx for the info. Nice job the component. I took one look at the task scheduler documentation and started looking for a readymade.

It is very functional, well done
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    SiComponents Forums Forum Index -> VCL Scheduling Agent All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by p h p B B  © 2001, 2005 p h p B B  Group