I'm useing TSiLang5.2.5 with Delphi6.
My Project is work well,it has tens of forms and units with TSilang.All the tsilang is linked to siLangDispatcher on the DataModule.The End User can edit the .SIB file easily and can be loaded as run time.
But suddenly,a strange question happen,the Project can not load sib file at run-time:(
It has an exception :Access violation at address **** in module **.exe...
When I use Breakpoint,I find the question is at:
procedure TSIBFileManager.LoadFromStream(const AComp: TsiCustomLang; const
AOwnerClassName: string; AStream: TStream);
....
siClass := TComponentClass(GetClass(AComp.Classname));
SI := TsiCustomLang(siClass.Create(frm));//error here...
....
I find the siClass is nil ,so ...
Is this a question with tsilang? or my code error?
A Strange question with TSiLang5.2.5
When GetClass() returns nil this means that by some reason Delphi doesn't "know" the requested class.weide wrote:What does "made some class registration/unregistration routines" mean?Could you give me some example?
Can you check what value returns the AComp.Classname ?
Wait! I have one idea:
May be you've created your SIB file from SIL? In such case please add siLngLnk to uses clause of your application units. Anyway, please check what AComp.Classname returns and be sure that your project knows about such class, in case not just add the respective unit from TsiLang folder to your uses clause.
Please let us know if this helps.
To isiticov:
I think I have resolved the question.
1.AComp.Classname is TSilang,but getClass is nil
2.siLngLnk is no use...but when I use TSilangDispatcher in a dll,it is nessessary...I will say more later...
3.The answer to My question:For some reason,I used showmessage,and in my uses clause,I used 'QDialogs'---Just this reason.Replace with Dialogs.Every thing is OK! You can test it.But I think no other else use QDialogs maybe.
4.When used in DLL I define a Form in DLL,and I want to support mulilanguages too.But It seems no use.The Code I write like this:
Function fShowRoutineChartForTradex(AHandle:THandle;zltx:string;ChartType:integer; SmpSize:integer; RawData:array of double;usl,sl,lsl:double;bGiven:boolean;bUcl,bCL,bLcl:double;AComp:TComponent=nil):wordbool;
begin
result:=true;
application.Handle:=AHandle;
With TfrmGraph.Create(application) do
try
if AComp is TsiLangDispatcher then begin
siLang1.LangDispatcher:=TsiLangDispatcher(AComp);
TsiLangDispatcher(AComp).LoadAllFromFile(TsiLangDispatcher(AComp).FileName);
end;
ShowModal
finally
Free;
end;
end;
The same code I use by source--I mean add the DLL source to my project ,It work well...
Is TSilang support DLL form and load from SIB file?
I think I have resolved the question.
1.AComp.Classname is TSilang,but getClass is nil
2.siLngLnk is no use...but when I use TSilangDispatcher in a dll,it is nessessary...I will say more later...
3.The answer to My question:For some reason,I used showmessage,and in my uses clause,I used 'QDialogs'---Just this reason.Replace with Dialogs.Every thing is OK! You can test it.But I think no other else use QDialogs maybe.
4.When used in DLL I define a Form in DLL,and I want to support mulilanguages too.But It seems no use.The Code I write like this:
Function fShowRoutineChartForTradex(AHandle:THandle;zltx:string;ChartType:integer; SmpSize:integer; RawData:array of double;usl,sl,lsl:double;bGiven:boolean;bUcl,bCL,bLcl:double;AComp:TComponent=nil):wordbool;
begin
result:=true;
application.Handle:=AHandle;
With TfrmGraph.Create(application) do
try
if AComp is TsiLangDispatcher then begin
siLang1.LangDispatcher:=TsiLangDispatcher(AComp);
TsiLangDispatcher(AComp).LoadAllFromFile(TsiLangDispatcher(AComp).FileName);
end;
ShowModal
finally
Free;
end;
end;
The same code I use by source--I mean add the DLL source to my project ,It work well...
Is TSilang support DLL form and load from SIB file?
This will not work in DLL, because DLL and main executable has different RTTI spaces and such operands asif AComp is TsiLangDispatcher then begin
Code: Select all
IS, AS