Autor Beitrag
bernd29
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 116

winxp
D7 und VB6
BeitragVerfasst: Di 12.04.05 21:21 
Hallo :wink2:

Ich hab da mal ne Frage. Kann ich eine form als dll Laden ?
Und vor allem wie?

MfG

_________________
Es ist keine Schande, nichts zu wissen, wohl aber, nichts lernen zu wollen.
Sokrates
HECHT
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 24


D7
BeitragVerfasst: Di 12.04.05 22:42 
Sowas müsste dann in deiner DLL sein:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
{$R *.RES}

procedure DLLFormShow;
var
  DLLForm1: TDLLForm1;
begin
  DLLForm1:=TDLLForm1.Create(Application);
  try
    DLLForm1.ShowModal;
  finally
    DLLForm1.Release;
  end;
end;

exports DLLFormShow;


Und so wirds aufgerufen:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
procedure DLLFormShow  stdcall; external '<dllname>.dll';


procedure TForm1.Button1Click(Sender: TObject);
 begin
  DLLFormular;
end;


Info zu DLL's:
www.dsdt.info/tipps/?id=105
bernd29 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 116

winxp
D7 und VB6
BeitragVerfasst: Mi 13.04.05 14:58 
Hallo,

Danke für deine Hilfe . :beer:

verstanden hab ich das aber noch nicht so mit dem umwandel . kann mir das mal jemand näher erklären??? :wink:


    Export von Formularen
    Wenn man häufig die gleichen Formulare benötigt, ist eine DLL mit eingebundenen Formularen ideal. Die Vorgehensweise gleicht dem Erstellen "normaler" Projekte: Man wirft die Komponenten aufs Formular und erstellt die Ereignisroutinen. Um das Projekt in eine DLL zu verwandeln geht man dann folgendermaßen vor:

    In der Projektdatei das Hauptprogramm löschen (Application.CreateForm(TForm1, Form1);)
    Ändern des Bezeichner "programm" in "library"
    Erstellen einer Schnittstellenroutine
    In der Schnittstellenroutine wird das Formular "createt" und angezeigt:



MfG

_________________
Es ist keine Schande, nichts zu wissen, wohl aber, nichts lernen zu wollen.
Sokrates
HECHT
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 24


D7
BeitragVerfasst: Mi 13.04.05 16:35 
Hallo,
Ich versuchs mal simpel zu erklären.
Diese Anleitung ist dafür gedacht, dass du ein bestehendes TForm, welches Bestandteil einer EXE ist, als DLL ummoddeln kannst, sodass du dann statt nur einer xy.exe neu
eine xy.exe und ein xyForm.dll hast.

Es wird wohl einfacher sein, als ersten Schritt ein gewöhnliches Form zu desingen und wenn es fertig ist, so modifizieren, dass daraus eine DLL wird, statt eine DLL, welche ein Form beinhaltet von Grund auf zu bauen, dann sieht man auch den Unterschied.

Oder anderst gesagt du hast dann zwei DPR(Projekte) ein DPR für deine EXE und ein DPR für die DLL.

Unter Datei Neu hat es einen Wizard für Dll's, ich empfehle, mach einfach mal eine DLL anhand der obigen Anleitung. Übung macht den Meister.

Hoffe es hilft weiter...
bernd29 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 116

winxp
D7 und VB6
BeitragVerfasst: Mi 13.04.05 16:47 
Hmm... hab ich so gemacht nur delphi7 spielt net mit und macht fehler meldungen . wen ich type drin lasse gehts net, nehme ich es raus gehts auch nicht .

MfG
bernd29 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 116

winxp
D7 und VB6
BeitragVerfasst: Mi 13.04.05 16:52 
so müsste es nach den angaben aussehen oder nicht????

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
unit Unit1; // <= änderung ( library dll; )

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs;

type
  TForm1 = class(TForm)
    procedure FormCreate(Sender: TObject);
  private
    { Private-Deklarationen }
  public
    { Public-Deklarationen }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm} // <= Änderung {$R *.res}


Hab ich was vergessen???????
JayEff
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2971

Windows Vista Ultimate
D7 Enterprise
BeitragVerfasst: Mi 13.04.05 17:32 
du sollst nich das Unit mit library ersetzen... sondern das "Programm" in der projelt datei. drück strg+F12 und wähle deine projekt datei statt der unit...

_________________
>+++[>+++[>++++++++<-]<-]<++++[>++++[>>>+++++++<<<-]<-]<<++
[>++[>++[>>++++<<-]<-]<-]>>>>>++++++++++++++++++.+++++++.>++.-.<<.>>--.<+++++..<+.
bernd29 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 116

winxp
D7 und VB6
BeitragVerfasst: Mi 13.04.05 17:42 
habs jetzt, allerding bekomme ich bei formshow fehler meldung .

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
library dll;

uses
  Forms,
  Unit1 in 'Unit1.pas' {Form1};

{$R *.res}

procedure DLLFormShow;
var
  Form1: TForm1;
begin
  Form1:=TForm1.Create(Application);
  try
    Form1.ShowModal;
  finally
    Form1.Release;
  end;  
end;

 
exports FormShow;

end.


MfG

_________________
Es ist keine Schande, nichts zu wissen, wohl aber, nichts lernen zu wollen.
Sokrates
JayEff
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2971

Windows Vista Ultimate
D7 Enterprise
BeitragVerfasst: Mi 13.04.05 18:14 
1. Welche Fehlermeldung (immer mit sagen)
2. Der Quelltext sollte normalerweise in die Unit datei...

_________________
>+++[>+++[>++++++++<-]<-]<++++[>++++[>>>+++++++<<<-]<-]<<++
[>++[>++[>>++++<<-]<-]<-]>>>>>++++++++++++++++++.+++++++.>++.-.<<.>>--.<+++++..<+.
bernd29 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 116

winxp
D7 und VB6
BeitragVerfasst: Mi 13.04.05 18:21 
fehler meldung : datei dll.res nicht gefunden.
die dll ist aber den doch da.

und beim aufrufen der form per button : dllformular undefinierter bezeichner.

MfG
JayEff
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2971

Windows Vista Ultimate
D7 Enterprise
BeitragVerfasst: Mi 13.04.05 18:22 
die compiler anweisung soll in der projekt datei stehen, der code in der unit ^^

_________________
>+++[>+++[>++++++++<-]<-]<++++[>++++[>>>+++++++<<<-]<-]<<++
[>++[>++[>>++++<<-]<-]<-]>>>>>++++++++++++++++++.+++++++.>++.-.<<.>>--.<+++++..<+.
bernd29 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 116

winxp
D7 und VB6
BeitragVerfasst: Mi 13.04.05 18:30 
Na hab ich doch

gucks du

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
library dll;

uses
  Forms,
  Unit1 in 'Unit1.pas' {dllform};

{$R *.res}

procedure DLLFormShow;
var
  dllForm: TdllForm;
begin
  dllForm:=TdllForm.Create(Application);
  try
    dllForm.ShowModal;
  finally
    dllForm.Release;
  end;  
end;

 
exports dllForm;

end.


und wie kann ich die form aufrufen geht auch nicht.

_________________
Es ist keine Schande, nichts zu wissen, wohl aber, nichts lernen zu wollen.
Sokrates
bernd29 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 116

winxp
D7 und VB6
BeitragVerfasst: Mi 13.04.05 18:43 
hab den fehler gefunden

jetzt soll ich eine horst anwendung definiren ,wie mach ich das?

MfG
GTA-Place
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
EE-Regisseur
Beiträge: 5248
Erhaltene Danke: 2

WIN XP, IE 7, FF 2.0
Delphi 7, Lazarus
BeitragVerfasst: Mi 13.04.05 18:47 
Ich kenn einen, der heißt "Horst" den kannste ja mal fragen :wink: :)

_________________
"Wer Ego-Shooter Killerspiele nennt, muss konsequenterweise jeden Horrorstreifen als Killerfilm bezeichnen." (Zeit.de)
JayEff
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2971

Windows Vista Ultimate
D7 Enterprise
BeitragVerfasst: Mi 13.04.05 20:07 
das steht doch in der fehlermeldung drin... über "start -> Parameter"... macht natürlich keinen sinn, ne hostanwendung auszueählen, die deine dll garnicht benutzt. schreib dir am besten ein extra programm dafür. eines, mit dem du deine dll komplett durchtesten kannst.

_________________
>+++[>+++[>++++++++<-]<-]<++++[>++++[>>>+++++++<<<-]<-]<<++
[>++[>++[>>++++<<-]<-]<-]>>>>>++++++++++++++++++.+++++++.>++.-.<<.>>--.<+++++..<+.
bernd29 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 116

winxp
D7 und VB6
BeitragVerfasst: Mi 13.04.05 20:10 
schon passiert geht auch . ich kann nur die form aus der dll nicht anzeigen .

MfG
JayEff
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2971

Windows Vista Ultimate
D7 Enterprise
BeitragVerfasst: Mi 13.04.05 20:11 
fehlermeldungen? sonst was? passiert einfach garnix? oO gib mal code...

_________________
>+++[>+++[>++++++++<-]<-]<++++[>++++[>>>+++++++<<<-]<-]<<++
[>++[>++[>>++++<<-]<-]<-]>>>>>++++++++++++++++++.+++++++.>++.-.<<.>>--.<+++++..<+.
bernd29 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 116

winxp
D7 und VB6
BeitragVerfasst: Mi 13.04.05 20:17 
also die fehler meldung ist wech , hab das host prog angegeben aber wen ich den button drücke passiert garnix.

die dll
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
library Project1;

uses
  Forms,
  Unit1 in 'Unit1.pas' {dllform};

{$R *.res}

procedure DLLFormShow;
var
  dllForm: TForm;
begin
  dllForm:=TForm.Create(Application);
  try
    dllForm.ShowModal;
  finally
    dllForm.Release;
  end;  
end;

 
exports dllFormshow;

end.


Hauptprogramm Form mit button
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure DLLFormShow  stdcall; external '<dllname>.dll';  

 

 
procedure TForm1.Button1Click(Sender: TObject);  
 begin  
  DLLFormular;  
end;

end.


MfG

_________________
Es ist keine Schande, nichts zu wissen, wohl aber, nichts lernen zu wollen.
Sokrates
JayEff
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2971

Windows Vista Ultimate
D7 Enterprise
BeitragVerfasst: Mi 13.04.05 20:20 
user profile iconbernd29 hat folgendes geschrieben:

ausblenden Delphi-Quelltext
1:
2:
3:
procedure DLLFormShow;
{...}
exports dllFormshow;


Hauptprogramm Form mit button
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
{...}
procedure DLLFormShow  stdcall; external '<dllname>.dll';  

procedure TForm1.Button1Click(Sender: TObject);  
 begin  
  DLLFormular; //ähm??? woher soll der compiler diese seltsame funktion kennen? es gibt doch nur "DLLFormShow" oder???
end;

end.



Schon die namen richtig schreiben ;)

_________________
>+++[>+++[>++++++++<-]<-]<++++[>++++[>>>+++++++<<<-]<-]<<++
[>++[>++[>>++++<<-]<-]<-]>>>>>++++++++++++++++++.+++++++.>++.-.<<.>>--.<+++++..<+.
bernd29 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 116

winxp
D7 und VB6
BeitragVerfasst: Mi 13.04.05 20:24 
immer noch undrfimierter bezeichner :cry:


MfG