Recent

Author Topic: [SOLVED] Task Schreduling in Windows 7 (API ver. 2) ??  (Read 31336 times)

marcov

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 7624
Re: [SOLVED] Task Schreduling in Windows 7 (API ver. 2) ??
« Reply #30 on: December 20, 2011, 09:25:56 pm »
Yes, that is fine with me also.  There was a contributor (Matej ?? from Croatia) who contributed a lot to the early COM support working on something like that , but he stopped responding at some point.
I'm progressing nicely on the importer. When working,  I'll create another thread to post the code instead of highjacking this one, or shall I create a new issue in the bugtracker?

For me Mantis is easier. FPC project though :_)
 

nicke85

  • Jr. Member
  • **
  • Posts: 92
  • #13#10
Re: [SOLVED] Task Schreduling in Windows 7 (API ver. 2) ??
« Reply #31 on: December 23, 2011, 11:18:58 am »
I work with olevariant,and need to pass datetime from example TDateTimePicker or some other source into my method which pass that value to olevariant.
Does I need to specify format of datetime to some specific format for olevariant?
ArchLinux X64 (XFCE) & Windows 7 SP1 Ultimate X64
FPC 2.7.1 / Lazarus 1.1 / ZeosDBO / fortes4lazarus -- all svn

ludob

  • Hero Member
  • *****
  • Posts: 1173
Re: [SOLVED] Task Schreduling in Windows 7 (API ver. 2) ??
« Reply #32 on: December 23, 2011, 11:51:30 am »
I work with olevariant,and need to pass datetime from example TDateTimePicker or some other source into my method which pass that value to olevariant.
Does I need to specify format of datetime to some specific format for olevariant?
Just assign TDateTime to OleVariant.

nicke85

  • Jr. Member
  • **
  • Posts: 92
  • #13#10
Re: [SOLVED] Task Schreduling in Windows 7 (API ver. 2) ??
« Reply #33 on: December 23, 2011, 12:25:32 pm »
Quote
Just assign TDateTime to OleVariant.
I doesn't work.I found solution sorry for my fast question.
Datetime must be formated like YYYY-MM-DDTHH:MM:SS(+-)HH:MM
so i wrote Function to convert TDateTimePiscker or any datetime class to right format because
olevariant can handle string and pass to right format ;)

Code: [Select]
function TForm1.SetTime(DateTimePicker: TDateTimePicker): string;
var
date: ShortString;
time: ShortString;
begin
 DateSeparator:='-';
 date:=FormatDateTime('yyyy/mm/dd', DateTimePicker.Date);
 time:=FormatDateTime('HH:MM:SS',DateTimePicker.Time);
 Result:=date+'T'+time+'+01:00';
end;
end.
ArchLinux X64 (XFCE) & Windows 7 SP1 Ultimate X64
FPC 2.7.1 / Lazarus 1.1 / ZeosDBO / fortes4lazarus -- all svn

ludob

  • Hero Member
  • *****
  • Posts: 1173
Re: [SOLVED] Task Schreduling in Windows 7 (API ver. 2) ??
« Reply #34 on: December 23, 2011, 04:04:21 pm »
Quote
I doesn't work.
I guess you are trying to set StartBoundary or EndBoundary. These are defined as a WideString with a particular format and no "automagic" OLEVariant conversion will work. There are properties such as IRegisteredTask.NextRunTime that use a TDateTime compatible format.
Quote
Result:=date+'T'+time+'+01:00';
Task Scheduling api uses UTC and +1:00 is CET winter time. You'll need to adapt your routine to local timezone and day savings time.

nicke85

  • Jr. Member
  • **
  • Posts: 92
  • #13#10
Re: [SOLVED] Task Schreduling in Windows 7 (API ver. 2) ??
« Reply #35 on: December 23, 2011, 08:39:23 pm »

I guess you are trying to set StartBoundary or EndBoundary. These are defined as a WideString with a particular format and no "automagic" OLEVariant conversion will work. There are properties such as IRegisteredTask.NextRunTime that use a TDateTime compatible format.
Yes Start and End DateTime.DateTimePicker is only testing for format input.
Well function from above done the job.I can pass ShortString to olevariant..:)

Regards
ArchLinux X64 (XFCE) & Windows 7 SP1 Ultimate X64
FPC 2.7.1 / Lazarus 1.1 / ZeosDBO / fortes4lazarus -- all svn