Autor Beitrag
GlaN
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 27

win XP Pro
D2005
BeitragVerfasst: Mi 20.07.05 15:48 
hi

ich habe ein Programm in dem ich eine Save und Laden Procedure habe.
wie kann ich dieser gspeicherten datei von Windows aus öffen?
einfach über öffen mit....
dazu brauch ich ja beim programmstart irgend eine Procedure, oder?

hab dazu leider nichts gefunden

mfg GlaN
maxk
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1696
Erhaltene Danke: 1

Win XP, Debian Lenny
Delphi 6 Personal
BeitragVerfasst: Mi 20.07.05 16:09 
Windows übergibt dir Parameter, die du auswerten kannst. Such mal unter Suche in: Delphi-Forum, Delphi-Library "PARAMSTR" bzw. Suche in: Delphi-Forum, Delphi-Library "PARAMCOUNT"! Da findest du bestimmt eine ganze Menge dazu ;)

Gruß,
maxk

_________________
Ein Computer wird das tun, was Du programmierst - nicht das, was Du willst.
GlaN Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 27

win XP Pro
D2005
BeitragVerfasst: Mi 20.07.05 19:04 
Danke

ein Problem hab ich aber noch:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
procedure TForm1.FormCreate(Sender: TObject);
begin
  if ParamCount > 0 then  
  begin  
    showmessage(Paramstr(1));
  end;
...


ich bekomme nie eine Message!!!
auch wenn ich die Datei anklicke und offen mit sage

wieso geht das nicht?

wenn ich nur
ausblenden Delphi-Quelltext
1:
showmessage(Paramstr(1));					

schreibe macht er auch nichts


[Edit]
so mit einer Verknüpfung funktioniert das jetzt, nur mit den Datein selber noch nicht

Verknüpfung:
ausblenden Quelltext
1:
F:\OD\Editor\v6\Editor.exe F:\OD\Editor\v6\versuch.sph					

[/Edit]
maxk
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1696
Erhaltene Danke: 1

Win XP, Debian Lenny
Delphi 6 Personal
BeitragVerfasst: Mi 20.07.05 19:46 
Hmm, das sollte aber eigentlich funktionieren. Wie sieht es denn aus, wenn du den Dateityp direkt mit dem Programm verknüpfst (entweder über Windowsexplorer oder direkt in der Registry)?

Gruß,
maxk

_________________
Ein Computer wird das tun, was Du programmierst - nicht das, was Du willst.
GlaN Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 27

win XP Pro
D2005
BeitragVerfasst: Do 21.07.05 05:18 
zur zeit habe ich das über den Windowsexplorer verknüpft.....
was ich ja auch nicht verstehe ist das ich bei dieser Variante:
showmessage(Paramstr(1));

nicht mal eine leere Message bekomme, normal sollte er ja einfach eine Message mit einem leer string ausgeben!
maxk
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1696
Erhaltene Danke: 1

Win XP, Debian Lenny
Delphi 6 Personal
BeitragVerfasst: Do 21.07.05 14:16 
Schau mal in der Registry nach: HKEY_CLASSES_ROOT\.Endung
Den Wert dieses Schlüssels setzt du dann mal hier ein: HKEY_CLASSES_ROOT\Wert\shell\open\command
Dort sollte stehen: "Pfad zu deinem Programm" "%1"

Gruß,
maxk

_________________
Ein Computer wird das tun, was Du programmierst - nicht das, was Du willst.
GlaN Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 27

win XP Pro
D2005
BeitragVerfasst: Do 21.07.05 19:57 
ja ist so drinnen
maxk
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1696
Erhaltene Danke: 1

Win XP, Debian Lenny
Delphi 6 Personal
BeitragVerfasst: Do 21.07.05 21:25 
Steht dort evtl. was von BBE (oder wie das heißt)? Falls ja lösch es. Ansonsten weiss ich aus der Ferne auch nicht weiter ;)

Gruß,
maxk

_________________
Ein Computer wird das tun, was Du programmierst - nicht das, was Du willst.
Alstar
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 827



BeitragVerfasst: Do 21.07.05 21:38 
user profile iconmaxk hat folgendes geschrieben:
Steht dort evtl. was von BBE (oder wie das heißt)? Falls ja lösch es. Ansonsten weiss ich aus der Ferne auch nicht weiter ;)[...]


DDE, maxk! :wink:
Und falls das aktiviert wäre, würde eine Fehlermeldung kommen, wenn das Programm kein DDE unterstützt

user profile iconGlaN hat folgendes geschrieben:
[...]was ich ja auch nicht verstehe ist das ich bei dieser Variante:
showmessage(Paramstr(1));
nicht mal eine leere Message bekomme, normal sollte er ja einfach eine Message mit einem leer string ausgeben!


Wo rufst Du das auf, also in welcher Funktion?

Alstar
maxk
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1696
Erhaltene Danke: 1

Win XP, Debian Lenny
Delphi 6 Personal
BeitragVerfasst: Do 21.07.05 21:43 
user profile iconAlstar hat folgendes geschrieben:
DDE, maxk! :wink:
Naja, einen Versuch war's wert :lol:

user profile iconGlaN hat folgendes geschrieben:
[...]was ich ja auch nicht verstehe ist das ich bei dieser Variante:
showmessage(Paramstr(1));
nicht mal eine leere Message bekomme, normal sollte er ja einfach eine Message mit einem leer string ausgeben!
Schreib dochmal Paramstr(0) wenn dann immernoch nix kommt, wird der Befehl gar nicht ausgeführt ;)


Gruß,
maxk

_________________
Ein Computer wird das tun, was Du programmierst - nicht das, was Du willst.
Alstar
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 827



BeitragVerfasst: Do 21.07.05 21:45 
Ach ne?! Was ich oben bereits erwähnt hab: Natürlich wird der Befehl nicht ausgeführt, wenn er nochnichtmal ne Messagebox bekommt, oder!?

Alstar
maxk
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1696
Erhaltene Danke: 1

Win XP, Debian Lenny
Delphi 6 Personal
BeitragVerfasst: Do 21.07.05 21:49 
Naja, bis eben war ich der festen Meinung, dass ShowMessage nichts macht, wenn ein leerer String übergeben wird. Wäre ParamStr(1) leer gewesen, hätte das ja Sinn gemacht. Habe mich nun aber selbst eines besseren belehrt 8)

Gruß,
maxk

_________________
Ein Computer wird das tun, was Du programmierst - nicht das, was Du willst.
GlaN Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 27

win XP Pro
D2005
BeitragVerfasst: Fr 22.07.05 05:23 
das ganze hab ich am ende der FormCreate Procedure hin geschrieben....
mit Paramstr(0) bekomm ich wie es sein sollte den pfad zum Programm...
was ich ja eigenartig finde sit das wenn ich das Programm mit Delphi Compekiere eine lehre messagebox kommt, sobald ich es aber öber die Exe starte kommt die nicht mehr, wenn ich aber eine Verknüpfung erstelle so wie obern, funktioniert das wieder...
maxk
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1696
Erhaltene Danke: 1

Win XP, Debian Lenny
Delphi 6 Personal
BeitragVerfasst: Fr 22.07.05 09:27 
Poste doch mal bitte den Sourcecode deiner Form.OnCreate Methode...

_________________
Ein Computer wird das tun, was Du programmierst - nicht das, was Du willst.
GlaN Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 27

win XP Pro
D2005
BeitragVerfasst: Fr 22.07.05 12:50 
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:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
procedure TForm1.FormCreate(Sender: TObject);
var
    i : integer;
    jpeg : TJPEGImage;
begin
  //Techsladen
  path := ExtractFilePath(Application.ExeName)+'\Data\';
  TPicture.RegisterFileFormat('jpg', 'JPG Files', TJPEGImage);
  TPicture.RegisterFileFormat('jpeg', 'JPG Files', TJPEGImage);
  pod := path+'Techs\a.jpeg';
  ras := 1;
  alist := tstringlist.Create;
  aslist := tstringlist.Create;
  atech := 0;
  techgrid.Refresh;
  techlist := tstringlist.Create;
  bit := tpicture.Create;
  techlist.LoadFromFile(path+'Angriff.txt');
  jpeg := TJPEGImage.Create;
  optList := tstringlist.Create;
  optList.LoadFromFile(path+'Optionen.txt');
   case (strtoint(optList[0]))  of
      1:  jpeg.LoadFromFile(path+techlist.Strings[0]+'.jpg');
      2:  jpeg.LoadFromFile(path+techlist.Strings[0]+'2.jpg');
  end;
  techgrid.picture.Bitmap.Assign(jpeg);
  bit := techgrid.Picture;
  jpeg.Free;
  list := 5;


  techgrid.refresh;
  techgrid.Picture := bit;
  techgrid.Stretch := true;
  techgrid.Height := techgrid.Height div 2;
  techgrid.Width := techgrid.Width div 2;

  image23.Picture.LoadFromFile(path+'OSe.jpg');
  //Shiffe laden
  //******************************************************************************
  if ParamCount > 0 then  
  begin  
    showmessage(Paramstr(1));
  end;
  //******************************************************************************

  shipgrid.Refresh;
  shiplist := tstringlist.Create;
  shiplist.loadfromfile(path+'Schiffverzeichnisse.txt');
  case (strtoint(optList[0]))  of
      1: oldstyle;
      2: newstyle;
      end;

  //Rechteck initialisieren
  rectold.Right := 0;
  rectold.Top := 0;
  rectold.Left := 100;
  rectold.Bottom := 90;
  owi;
  shipg := false;

  for i := 1 to 18 do podsav[i] := -1;
  for i := 1 to 18 do listarray[i] := -1;
  for i := 1 to 20 do rasse[i] := 0;

  save := true;

  cb1.SelText := '';
  cb1.seltext := 'Menschen (3,0%)';

  ras := 1;
  pe := 300;
  pm := 300;
  pw := 300;
  pk := 300;
  pf := 300;
  pa := 25;

  list := 1;
  akt;
  form1.Height:=756;
  form1.Width:=1024;
  image1.Transparent:=true;
  image2.Transparent:=true;
  image3.Transparent:=true;
  image4.Transparent:=true;
  image7.Transparent:=true;
  image8.Transparent:=true;
  image9.Transparent:=true;
  image10.Transparent:=true;
  image11.Transparent:=true;
  image12.Transparent:=true;
  image13.Transparent:=true;
  image14.Transparent:=true;
  image15.Transparent:=true;
  image16.Transparent:=true;
  image17.Transparent:=true;
  image18.Transparent:=true;
  image19.Transparent:=true;
  image20.Transparent:=true;
  image21.Transparent:=true;
  image22.Transparent:=true;

end;
GlaN Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 27

win XP Pro
D2005
BeitragVerfasst: So 24.07.05 14:41 
also ich hab es ihn bekommen das die message angezeigt wird, also ich bekomme den Pfad herein....

hab aber noch ein Problem mit dem Laden....
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
  
if ParamCount > 0 then
    begin
     panel1.OnClick(sd);
     form4.Visible:=false;
     Form4.m.lines.LoadFromFile(Paramstr(1));
     form4.panel2.onclick(od);
     form1.Visible:=true;
     form1.Enabled:=true;
    end

ich fürchte das ich in der FormCreate Methode nicht auf ein anderes Form zugreifen kann, wenn das stimmt hat jemand eine Idee wie man das anders machen kann...

mfg GlaN
maxk
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1696
Erhaltene Danke: 1

Win XP, Debian Lenny
Delphi 6 Personal
BeitragVerfasst: So 24.07.05 21:52 
Das wird nicht gehen, da das erste Form vor allen anderen erstellt wird (siehe Quelltext deiner Projektdatei). Daher ist der Zugriff auf die anderen Forms erst später möglich - z.B. bei OnActivate.

Gruß,
maxk

_________________
Ein Computer wird das tun, was Du programmierst - nicht das, was Du willst.
GlaN Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 27

win XP Pro
D2005
BeitragVerfasst: Mo 25.07.05 20:14 
Danke funktioniert