I am using the OmniThreadLibrary in a Delphi 2007 app that utilises the global thread pool to preform some file operations (I need to try and make sure they are done in a specific order).
I have the contents of a newly created Ini file that is stored in a TStringList.
I then pass the TStringList to an instance of TOmniTask.
class procedure saveIniFile(const iniFile: TStringList);
var
task : IOmniTaskControl;
begin
task := CreateTask(saveIniFileTask, 'saveIniFile')
.SetParameter('iniFile', iniFile)
.Unobserved
.Schedule;
end;
I cannot figure out how to retrieve the TStringList in the TOmniTask instance
class procedure saveIniFileTask(const task: IOmniTask);
var
iniFile: TStringList;
begin
iniFile := task.Param['iniFile'];
end;
The above would return an error:
Incompatible types: 'TStringList' and 'TOmniValue'
I have tried typecasting:
iniFile:= TStringList(task.Param['iniFile'].AsObject);
But get a compiler error:
F2084 Internal Error: C4310
I am using OmniThreadLibrary version 3.0 - I cant get 3.03b to compile in D2007
If @gabr is about: Great piece of work OmniThreadLibray, thank you.