AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

Problem mit DLL

Ein Thema von Amo · begonnen am 7. Jan 2006 · letzter Beitrag vom 7. Jan 2006
Antwort Antwort
Amo

Registriert seit: 26. Okt 2005
82 Beiträge
 
Delphi 7 Enterprise
 
#1

Problem mit DLL

  Alt 7. Jan 2006, 13:00
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:
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.
Im Hauptprogramm ist das ein radiobuttom, der angeklickt wird (dadurch soll sich die sprache ändern).

Was habe ich falsch gemacht?
  Mit Zitat antworten Zitat
Benutzerbild von JasonDX
JasonDX
(CodeLib-Manager)

Registriert seit: 5. Aug 2004
Ort: München
1.062 Beiträge
 
#2

Re: Problem mit DLL

  Alt 7. Jan 2006, 13:07
Ich glaub es fehlt n bissl an der Logik - oder dem Konzept
  • Woher soll der Compiler wissen, was Form1 ist?
  • Woher soll der Compiler wissen, was GroupBox1 ist?
  • Woher soll der Compiler wissen, was Button1 ist?
  • ......
Stimmt - kanner garnich wissen

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
Mike
Passion is no replacement for reason
  Mit Zitat antworten Zitat
Robert Marquardt
(Gast)

n/a Beiträge
 
#3

Re: Problem mit DLL

  Alt 7. Jan 2006, 13:18
Man sollte auch unbedingt den Kommentar lesen und ShareMem einbinden.
  Mit Zitat antworten Zitat
marabu

Registriert seit: 6. Apr 2005
10.109 Beiträge
 
#4

Re: Problem mit DLL

  Alt 7. Jan 2006, 13:19
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
  Mit Zitat antworten Zitat
Benutzerbild von Luckie
Luckie

Registriert seit: 29. Mai 2002
37.621 Beiträge
 
Delphi 2006 Professional
 
#5

Re: Problem mit DLL

  Alt 7. Jan 2006, 13:20
Und wenn die VCL in DLLs Verwendung findet, würde ich bpls, Borland spezifische DLLs, nutzen anstatt herkömmlichen DLLs.
Michael
Ein Teil meines Codes würde euch verunsichern.
  Mit Zitat antworten Zitat
Amo

Registriert seit: 26. Okt 2005
82 Beiträge
 
Delphi 7 Enterprise
 
#6

Re: Problem mit DLL

  Alt 7. Jan 2006, 13:28
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?
  Mit Zitat antworten Zitat
Antwort Antwort


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 14:58 Uhr.
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz