![]() |
Problem mit DLL
Ich habe hier ein Problem:
Und zwar geht es darum, dass ich mithilfe einer DLL einige Captions ändern möchte, doch dies geht irgendwie nicht. Hier der code meiner dll:
Delphi-Quellcode:
Im Hauptprogramm ist das ein radiobuttom, der angeklickt wird (dadurch soll sich die sprache ändern).
library Project2;
{ Important note about DLL memory management: ShareMem must be the first unit in your library's USES clause AND your project's (select Project-View Source) USES clause if your DLL exports any procedures or functions that pass strings as parameters or function results. This applies to all strings passed to and from your DLL--even those that are nested in records and classes. ShareMem is the interface unit to the BORLNDMM.DLL shared memory manager, which must be deployed along with your DLL. To avoid using BORLNDMM.DLL, pass string information using PChar or ShortString parameters. } uses SysUtils, Unit1, Messages, Dialogs, Classes; {$R *.res} procedure setgerman; stdcall; begin try Form1.GroupBox1.Caption := 'Sprache'; Form1.Button5.caption := 'Ton wählen'; Form1.Button6.caption := 'Zeit wählen'; Form1.Button1.caption := 'Wecker stellen'; Form1.BitBtn1.caption := '&Schließen'; Form1.BitBtn2.caption := '&Info'; Form1.Panel2.caption := 'nicht bereit'; except showmessage('shit'); end; end; procedure setfrench; stdcall; begin Form1.GroupBox1.caption := 'Langues'; Form1.Button5.caption := 'choisir sonnerie'; Form1.Button6.caption := 'choisir l´heure'; Form1.Button1.caption := 'démarrer le réveil'; Form1.BitBtn1.caption := '&Quitter'; Form1.BitBtn2.caption := '&Info'; Form1.Panel2.caption := 'pas réglé'; end; procedure setenglish; stdcall; begin Form1.GroupBox1.caption := 'Language'; Form1.Button5.caption := 'set sound'; Form1.Button6.caption := 'set time'; Form1.Button1.caption := 'set alarm'; Form1.BitBtn1.caption := '&Close'; Form1.BitBtn2.caption := '&About'; Form1.Panel2.caption := 'not ready'; end; exports setgerman, setfrench, setenglish; begin end. Was habe ich falsch gemacht? |
Re: Problem mit DLL
Ich glaub es fehlt n bissl an der Logik - oder dem Konzept :stupid:
zu deutsch: Du musst die unit mit TForm1 (ws. 'Unit1') auch in die DLL einbinden, und den Funktionen als Parameter 'Form1: TForm1' mitgeben, dann könnts klappen ;) greetz Mike |
Re: Problem mit DLL
Man sollte auch unbedingt den Kommentar lesen und ShareMem einbinden.
|
Re: Problem mit DLL
Was wird wohl in Unit1 stecken - Form1?
Ich würde trotzdem den aktiven part bei der jeweiligen Form (OnCreate) lassen und eine reine ressource dll verwenden. Grüße vom marabu |
Re: Problem mit DLL
Und wenn die VCL in DLLs Verwendung findet, würde ich bpls, Borland spezifische DLLs, nutzen anstatt herkömmlichen DLLs.
|
Re: Problem mit DLL
OK, ich hatte mir schon gedacht es ist sowas wie Chimaira erklärt hat. Aber wie mache ich das jetzt genau mit TForm1? Unit1.Form1. ... oder wie?
|
Alle Zeitangaben in WEZ +1. Es ist jetzt 19:53 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz