Autor Beitrag
agent_x
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 62

WIN 2000, Linux Kubuntu 6.06

BeitragVerfasst: Do 09.08.07 23:09 
Hallo,
kann mir jemand vielleicht sagen welchen Befehl man in Delphi eintippen muss
um eine andere .pas Datei zu öffnen [die .pas Datei ist natürlich in der .exe Datei entchalten]
MfG agent_x
cuejo
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 142

Win XP
Delphi 7 Personal und 2005 PE
BeitragVerfasst: Fr 10.08.07 00:55 
Hi
Leider hab ich nicht ganz verstanden was Du machen willst. Wenn Du eine .pas Datei nur öffnen willst, dann geht das mit Datei -> Öffnen. Wenn Du eine Unit einbinden willst, dann musst Du sie nur bei uses hinschreiben, oder auf Datei -> Unit verwenden gehen. Was meinst Du mit


user profile iconagent_x hat folgendes geschrieben:
[die .pas Datei ist natürlich in der .exe Datei entchalten]
?
Dass die .pas in dem Ordner mit der .exe liegt? Dann wird es wohl zweites sein... :think:

_________________
Computer sind dumm, aber fleißig. Deshalb arbeite ich so gerne damit.
agent_x Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 62

WIN 2000, Linux Kubuntu 6.06

BeitragVerfasst: Fr 10.08.07 06:42 
also ich meine meine .pas Datei ist in der compilierten Datei entchalten.
und ich will diese .pas mit meinem geproggtem programm öffnen.
und was soll ich denn bei uses hinschreiben?
cuejo
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 142

Win XP
Delphi 7 Personal und 2005 PE
BeitragVerfasst: Fr 10.08.07 16:07 
Suche in: Delphi-Forum, Delphi-Library SHELLEXECUTE
Damit kann man Dateien mit dem zugehörigen Programmen öffnen. Die .pas muss dann aber vorhanden sein, aus der compilierten .exe kann man sie nicht auslesen.

_________________
Computer sind dumm, aber fleißig. Deshalb arbeite ich so gerne damit.
arj
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 378

Win XP/Vista, Debian, (K)Ubuntu
Delphi 5 Prof, Delphi 7 Prof, C# (#Develop, VS 2005), Java (Eclipse), C++, QT, PHP, Python
BeitragVerfasst: Fr 10.08.07 16:43 
Nochmal zur Klärung.

Du willst ein Programm schreiben, welches den Sourcecode einer Pas-Datei darstellt?

oder

Du willst ein Sourcecode schreiben welcher Teile aus einer anderen Pas-Datei nutzt?
cuejo
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 142

Win XP
Delphi 7 Personal und 2005 PE
BeitragVerfasst: Fr 10.08.07 17:26 
Wo ich gerade Deinen Titel lese: Vielleicht meinst Du auch Suche in: Delphi-Forum, Delphi-Library TOPENDIALOG :gruebel: :nixweiss:

_________________
Computer sind dumm, aber fleißig. Deshalb arbeite ich so gerne damit.
raziel
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 2453

Arch Linux
JS (WebStorm), C#, C++/CLI, C++ (VS2013)
BeitragVerfasst: Fr 10.08.07 17:39 
Um dem heiteren Rätselraten ein Ende zu setzten, wäre es sehr praktisch user profile iconagent_x, wenn du uns mit ein bisschen Quelltext versorgen könntest :)

Gruß,
raziel

_________________
JSXGraph
_frank_
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 343
Erhaltene Danke: 1

Win XP
Delphi 3 Prof / Turbo Delphi Explorer
BeitragVerfasst: Fr 10.08.07 18:07 
user profile iconagent_x hat folgendes geschrieben:
[die .pas Datei ist natürlich in der .exe Datei entchalten]


ich gehe mal davon aus, dass du die pas-Datei manuell als Resource eingebunden hast und weist, dass du die compilierte version nicht (so) "decodieren" kannst.

pas1 RCDATA unit1.pas

dann kannst du diese Resource mit einem TResourceStream laden und per LoadFromStream z.B. in ein Memo laden (TStrings.LoadFromStream).

um eine resource auswählen zu können musst du dir per EnumResourceNames erstmal eine resourcenliste erstellen.

als Beispiel mal ein Quelltextauszug aus meinem DFMEditor bisschen modifiziert für deinen Zweck (die auskommentierten Zeilen sind nur zur filterung, ob es sich um ein formular handelt, evtl. brauchst du so etwas ähnliches):

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:
function EnumDfmNameProc(hModule: THandle; lpszType, lpszName: PChar;
  lParam: Integer): Boolean; stdcall;
var
  rs: TResourceStream;
  //Buf: String;
begin
  rs := TResourceStream.Create(hModule, lpszname, lpszType); // load resource in memory
  try
    try
      //setlength(buf,4);
      //rs.Read(Buf[1], 4); // read the first 4 bytes
      //if Buf = 'TPF0' then // is it a DFM resource?
      //begin
        TStrings(lParam).Add(StrPas(lpszName));
      //end;
    except
      raise;
    end;
  finally
    rs.free;
  end;
  Result := True;
end;

function TForm_DFMChooseRes.loadFile(filename:string):integer;
begin
  freelibrary(hModule);
  Listbox1.Clear;
  hModule:=LoadLibraryEx(PCHAR(filename),0,LOAD_LIBRARY_AS_DATAFILE);
  if hModule <> 0 then
  begin
    fName:=filename;
    EnumResourceNames(hModule, RT_RCDATA,@EnumDfmNameProc, Integer(Listbox1.Items));
  end;
  result:=hModule;
end;

procedure TForm_DFMChooseRes.getFormData(s:TStrings);
var rs:TResourceStream;
begin
  if hModule<>0 then
  begin
    rs :=TResourceStream.Create(hModule,formname,RT_RCDATA);
    Memo1.LoadFromStream(rs);
    rs.free;
    close;
  end;
end;


HTH Frank

_________________
EB FE (die wahrscheinlich kürzeste Endlosschleife der Welt :) )
BA 01 00 00 00 52 EB 09 BB 4D 11 86 7C FF D3 EB 0D E8 F2 FF FF FF 63 68 61 72 6D 61 70 00 C3
agent_x Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 62

WIN 2000, Linux Kubuntu 6.06

BeitragVerfasst: Fr 10.08.07 22:32 
hallo,
also ich hab ein menü und da will ich ein neues fenster öffnen [wenn man drauf clickt].
Also z.B: wie beifast allen programmen die versions info oder so
und diese Datei ist in der exe enthalten. Sie heißt ABOUT.pas

MfG agent_x
_frank_
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 343
Erhaltene Danke: 1

Win XP
Delphi 3 Prof / Turbo Delphi Explorer
BeitragVerfasst: Fr 10.08.07 22:35 
.oO(wohl doch nicht ganz so kompliziert, wie ichs vermutet habe :) )
du fügst zu deinem Projekt ein neues Formular (nicht nur eine Unit) hinzu.
dann bindest du die Unit in deine aufrufen unit ein (uses).
dann kannst du das formular über deinen Menüpunkt per Formularname.Show anzeigen.

Gruß Frank

_________________
EB FE (die wahrscheinlich kürzeste Endlosschleife der Welt :) )
BA 01 00 00 00 52 EB 09 BB 4D 11 86 7C FF D3 EB 0D E8 F2 FF FF FF 63 68 61 72 6D 61 70 00 C3
agent_x Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 62

WIN 2000, Linux Kubuntu 6.06

BeitragVerfasst: Fr 10.08.07 22:38 
hi wo und was muss man den in uses eintragen?
Das steht jetzt bei mir:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, DB, DBClient, MConnect, SConnect, Menus, ExtCtrls, ImgList, TypInfo,
  WebServExp, WSDLBind, XMLSchema, WSDLPub, StdCtrls, ComCtrls, DBXpress,
  SqlExpr, FMTBcd, jpeg, OleCtrls, SHDocVw;
_frank_
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 343
Erhaltene Danke: 1

Win XP
Delphi 3 Prof / Turbo Delphi Explorer
BeitragVerfasst: Fr 10.08.07 22:42 
den namen der unit, wo das form definiert ist, ohne Endung (also vermutlich unit2 solange du die unit nicht umbenannt hast oder du bereits eine andere unit2 hast).
ui...hast ziemlich viel bei dir in der uses (grade über die Typinfo,OleCtrls und SHDocVw wundere ich mich, weil dafür sollte eigentlich schon bisschen Wissen dahinter stehen, um die zu nutzen).

Frank

_________________
EB FE (die wahrscheinlich kürzeste Endlosschleife der Welt :) )
BA 01 00 00 00 52 EB 09 BB 4D 11 86 7C FF D3 EB 0D E8 F2 FF FF FF 63 68 61 72 6D 61 70 00 C3
agent_x Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 62

WIN 2000, Linux Kubuntu 6.06

BeitragVerfasst: Fr 10.08.07 22:55 
Moin,
also jetzt hab ich meine uses glaub ich richtig verändert:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, DB, DBClient, MConnect, SConnect, Menus, ExtCtrls, ImgList, TypInfo,
  WebServExp, WSDLBind, XMLSchema, WSDLPub, StdCtrls, ComCtrls, DBXpress,
  SqlExpr, FMTBcd, jpeg, OleCtrls, SHDocVw,About;

Hier mein ganzer Code:
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:
106:
107:
108:
109:
110:
111:
unit probe2;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, DB, DBClient, MConnect, SConnect, Menus, ExtCtrls, ImgList, TypInfo,
  WebServExp, WSDLBind, XMLSchema, WSDLPub, StdCtrls, ComCtrls, DBXpress,
  SqlExpr, FMTBcd, jpeg, OleCtrls, SHDocVw,About;
type
  TForm1 = class(TForm)
    MainMenu1: TMainMenu;
    Datei1: TMenuItem;
    Optionen1: TMenuItem;
    Hilfe1: TMenuItem;
    beruns1: TMenuItem;
    rueCombatElite1: TMenuItem;
    WolfensteinEnemyTerritory1: TMenuItem;
    Spiel1: TMenuItem;
    berdenClan1: TMenuItem;
    Server1: TMenuItem;
    Server2: TMenuItem;
    SpielStarten1: TMenuItem;
    SpielStarten2: TMenuItem;
    Exit1: TMenuItem;
    StartTheAllSeeingAye1: TMenuItem;
    N1: TMenuItem;
    Background: TImage;
    Label1: TLabel;
    Label3: TLabel;
    procedure beruns1Click(Sender: TObject);
    procedure Label3Click(Sender: TObject);
    procedure StartTheAllSeeingAye1Click(Sender: TObject);
    procedure Server1Click(Sender: TObject);
    procedure Exit1Click(Sender: TObject);
    procedure Server2Click(Sender: TObject);
    procedure SpielStarten1Click(Sender: TObject);
    procedure SpielStarten2Click(Sender: TObject);
    procedure Button1Click(Sender: TObject);
  private
    { Private-Deklarationen }
  public
    { Public-Deklarationen }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

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

procedure TForm1.SpielStarten2Click(Sender: TObject);
begin
 WinExec('"D:\Programme\Wolfenstein - Enemy Territory\ET.exe" +set fs_game tcetest +set com_hunkMegs 192 +set com_zoneMegs 64 +set com_soundMegs 64',1);
end;

procedure TForm1.SpielStarten1Click(Sender: TObject);
begin
WinExec('D:\Programme\Wolfenstein - Enemy Territory\ET.exe',1);
 end;

procedure TForm1.Server2Click(Sender: TObject);
begin
WinExec('D:\Programme\Wolfenstein - Enemy Territory\ETDED.exe +set fs_game -=cyber_mod=- +exec server.cfg',1);
end;

procedure TForm1.Exit1Click(Sender: TObject);
begin
CLOSE
end;

procedure TForm1.Server1Click(Sender: TObject);
begin
WinExec('D:\Programme\Wolfenstein - Enemy Territory\ETDED.exe +set fs_game tcetest +exec server.cfg',1);
end;

procedure TForm1.StartTheAllSeeingAye1Click(Sender: TObject);
begin
WinExec('"D:\Programme\The All-Seeing Eye\eye.exe"',1);

end;

function GetUsername: String;
var
  Buffer: array[0..255of Char;
  Size: DWord;
begin
  Size := SizeOf(Buffer);
  if not Windows.GetUserName(Buffer, Size) then
    RaiseLastOSError; //RaiseLastWin32Error; {Bis D5};
  SetString(Result, Buffer, Size - 1);

end;

procedure TForm1.Label3Click(Sender: TObject);
begin
Label3.Caption := GetUsername;
end;

procedure TForm1.beruns1Click(Sender: TObject);
begin
FormularAbout.Show
end;

end.


köntest du mir bitte sagen wo das Problem ist?
_frank_
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 343
Erhaltene Danke: 1

Win XP
Delphi 3 Prof / Turbo Delphi Explorer
BeitragVerfasst: Fr 10.08.07 22:59 
was kommt für ein fehler? dass FormularAbout nicht gefunden wird (undefinierter Bezeichner)?
ist in der about.pas ein FormularAbout:TFormularAbout (oder andere Form-Klasse) definiert?

ggf. mal die about.pas posten

oder wird about in der uses nicht gefunden? hast du diese hinzugefügt (taucht diese in dem Projektquelltext/Units-Liste auf)?

Gruß Frank

_________________
EB FE (die wahrscheinlich kürzeste Endlosschleife der Welt :) )
BA 01 00 00 00 52 EB 09 BB 4D 11 86 7C FF D3 EB 0D E8 F2 FF FF FF 63 68 61 72 6D 61 70 00 C3
agent_x Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 62

WIN 2000, Linux Kubuntu 6.06

BeitragVerfasst: Fr 10.08.07 23:02 
hier die abuot.pas:
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:
unit About;

interface

uses Windows, SysUtils, Classes, Graphics, Forms, Controls, StdCtrls,
  Buttons, ExtCtrls;

type
  TAboutBox = class(TForm)
    Panel1: TPanel;
    ProgramIcon: TImage;
    ProductName: TLabel;
    Version: TLabel;
    OKButton: TButton;
    procedure OKButtonClick(Sender: TObject);
  private
    { Private-Deklarationen }
  public
    { Public-Deklarationen }
  end;

var
  AboutBox: TAboutBox;

implementation

{$R *.dfm}

procedure TAboutBox.OKButtonClick(Sender: TObject);
begin
EXIT
end;

end.
_frank_
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 343
Erhaltene Danke: 1

Win XP
Delphi 3 Prof / Turbo Delphi Explorer
BeitragVerfasst: Fr 10.08.07 23:03 
dann AboutBox.show (statt FormularAbout.show) :) (siehe Zeile 23)

Gruß Frank

_________________
EB FE (die wahrscheinlich kürzeste Endlosschleife der Welt :) )
BA 01 00 00 00 52 EB 09 BB 4D 11 86 7C FF D3 EB 0D E8 F2 FF FF FF 63 68 61 72 6D 61 70 00 C3
agent_x Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 62

WIN 2000, Linux Kubuntu 6.06

BeitragVerfasst: Fr 10.08.07 23:07 
in der about.pas? so:?
ausblenden Delphi-Quelltext
1:
2:
3:
var
  AboutBox: TAboutBox;
  AboutBox: AboutBox.show;
_frank_
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 343
Erhaltene Danke: 1

Win XP
Delphi 3 Prof / Turbo Delphi Explorer
BeitragVerfasst: Fr 10.08.07 23:09 
nein, in deiner probe2.pas, wo du vorhin geschrieben hast FormularAbout.show, das einfach durch aboutbox.show ersetzen.

Frank :?!?:

_________________
EB FE (die wahrscheinlich kürzeste Endlosschleife der Welt :) )
BA 01 00 00 00 52 EB 09 BB 4D 11 86 7C FF D3 EB 0D E8 F2 FF FF FF 63 68 61 72 6D 61 70 00 C3
agent_x Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 62

WIN 2000, Linux Kubuntu 6.06

BeitragVerfasst: Fr 10.08.07 23:12 
ok,
vielendank