Autor Beitrag
ByStones
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 92
Erhaltene Danke: 1

Windows XP
Delphi 2005
BeitragVerfasst: Mo 28.03.05 16:22 
Hi,

Wie gebe ich eine Variable an ein anderes Delphiprogramm weiter ???

ByStones


Moderiert von user profile iconraziel: Topic aus Internet / Netzwerk verschoben am Mo 28.03.2005 um 18:27
raziel
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 2453

Arch Linux
JS (WebStorm), C#, C++/CLI, C++ (VS2013)
BeitragVerfasst: Mo 28.03.05 16:44 
user profile iconByStones hat folgendes geschrieben:
Hi,

Wie gebe ich eine Variable an ein anderes Delphiprogramm weiter ???

ByStones

Ein bisschen genauer...?
Soll das übers Netzwerk funktionieren oder auf dem gleichen Rechner. Ist das andere Programm von Dir oder ist das von jemand anders, soll heißen: Hast Du den Source-Code dazu?

Gruß,
raziel

_________________
JSXGraph
Karlson
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 2088



BeitragVerfasst: Mo 28.03.05 16:53 
Wenn du in Programm 1 z.B. einen String hast, den du in Programm 2 anzeigen lassen willst.

Dann speichere den String in Programm 1, irgendwo auf die Festplatte und lade ihn mit programm 2.

Es gäbe auch noch die saubere Möglichkeit der Suche in: Delphi-Forum, Delphi-Library PIPES, das ist für einen Anfänger aber definitiv zu "hoch", deswegen machst dir lieber einfach wie oben beschrieben.
ByStones Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 92
Erhaltene Danke: 1

Windows XP
Delphi 2005
BeitragVerfasst: Mo 28.03.05 16:53 
Titel: Hi
hi,

beide Programme sind von mir. ES läuft auf dem gleichen rechner ab !!!
ByStones Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 92
Erhaltene Danke: 1

Windows XP
Delphi 2005
BeitragVerfasst: Mo 28.03.05 16:58 
user profile iconKarlson hat folgendes geschrieben:
Wenn du in Programm 1 z.B. einen String hast, den du in Programm 2 anzeigen lassen willst.

Dann speichere den String in Programm 1, irgendwo auf die Festplatte und lade ihn mit programm 2.

...


Das ist eine möglichkeit, aber ich will damit eine Highscore verfassen. Also muss ich namen Punktestand und Datum weitergeben ich kann doch keine drei textdateien anlegen !!!!
Oder gibt es da eine bessere methode ???
Karlson
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 2088



BeitragVerfasst: Mo 28.03.05 17:01 
Schau mal hier
www.delphi-forum.de/...alisieren_35129.html


Du meinst mit zwei programmen aber nicht zufällig zwei forms, oder?
Fabian W.
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1766

Win 7
D7 PE
BeitragVerfasst: Mo 28.03.05 17:11 
Zitat:

Also muss ich namen Punktestand und Datum weitergeben ich kann doch keine drei textdateien anlegen !!!!
Oder gibt es da eine bessere methode ???


Du kannst die Werte doch in einer ini Datei übergeben.
ByStones Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 92
Erhaltene Danke: 1

Windows XP
Delphi 2005
BeitragVerfasst: Mo 28.03.05 17:33 
wie machte ich es aber, dass er ab einem bestimmten Zeichen denn text anders verarbeitet ???

lese bis ? in edit1 ein, weitereinlesen ab dem ersten ? bis zum zweiten ?

wie macht man das in delphi ???
raziel
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 2453

Arch Linux
JS (WebStorm), C#, C++/CLI, C++ (VS2013)
BeitragVerfasst: Mo 28.03.05 18:07 

_________________
JSXGraph
Fabian W.
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1766

Win 7
D7 PE
BeitragVerfasst: Mo 28.03.05 19:44 
Hast du schonmal mit Ini-Dateien gearbeitet, hört sich nicht so an.

Informiere dich erst einemal durch ein Tutorial oder ein Buch. Wenn ich dazu komme schreib ich dir kurz wie das geht. :wink:
Fabian W.
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1766

Win 7
D7 PE
BeitragVerfasst: Mo 28.03.05 19:58 
So, ich hatte gerade nichts zu tun, da hab ich dirs geschrieben:
ausblenden volle Höhe 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:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  inifiles, StdCtrls;

type
  TForm1 = class(TForm)
    EditName: TEdit;
    EditPunkte: TEdit;
    EditDat: TEdit;
    Button1: TButton;
    Button2: TButton;
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
  private
    { Private-Deklarationen }
  public
    { Public-Deklarationen }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.Button1Click(Sender: TObject);
var
inidat : Tinifile;             //So Infos in der Datei speichern
begin

Inidat := Tinifile.Create('C:\TestIni.ini');   //Erstellungort

with inidat do
begin
writestring('Punktestand','Name',EditName.text); //Kategorie: Punktestand, Wert: name, Eigenschaft: Das was in EditNam steht
writestring('Punktestand','Punkte',EditPunkte.text);
writestring('Punktestand','Datum',EditDat.text);
end;
end;

procedure TForm1.Button2Click(Sender: TObject);   //Werte laden
var
inidat : Tinifile;
begin
Inidat := Tinifile.Create('C:\TestIni.ini');

with inidat do
begin
EditName.text := readstring('Punktestand','Name',EditName.text);  //Lade aus Kategorie... den Wert von 'Name'
//..... usw.


end;
end;

end.



Das ist der Code um die 3 Infos aus Editfeldern zu lesen und in inis zu speichern, sowie die Infos wieder aus der Ini zu laden.

Ich würde dir empfehlen mal ein Buch über die Grundlagen von Delphi zu lesen :wink:

Moderiert von user profile iconGausi: Code- durch Delphi-Tags ersetzt.
Karlson
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 2088



BeitragVerfasst: Mo 28.03.05 20:01 
Fabian, lass doch mal bitte die Ini-Files weg. Was bringt ihm beim Highscore eine inifile? Eine Highscoreliste muss sortiert sein, außerdem ist eine TStringListe viel geschickter hier.
Fabian W.
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1766

Win 7
D7 PE
BeitragVerfasst: Mo 28.03.05 20:04 
Wenn er immer einzelne Infos weitergeben muss passt diese Variante. Was er sonst noch vorhat weis ich nicht. Er kann die INi's benutzten oder nicht das ist mir egal, aber mehrere Lösungansätzte sind immer besser als nur einer. :roll: