Autor Beitrag
DelphiNoobCoder
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 98

Win XP SP1

BeitragVerfasst: Fr 26.01.07 19:06 
Hi ich wollte fragen was ist hier der Fehler?

ausblenden Delphi-Quelltext
1:
ShellExecute(Form1.Handle, 'open'''+edit1.text+'unzip.exe''-oq SolidusRepack.zip'nil, SW_SHOWNORMAL);					


Als Fehler werden diese angezeigt

ausblenden Quelltext
1:
2:
3:
4:
5:
Build
  [Hint] Unit1.pas(46): Value assigned to 'GetInetFile' never used
  [Hint] Unit1.pas(75): Variable 'var1' is declared but never used in 'TForm1.FormCreate'
 >[Error] Unit1.pas(106): Incompatible types: 'String' and 'PAnsiChar'
  [Fatal Error] Project1.dpr(5): Could not compile used unit 'Unit1.pas'
Saubäär
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 376



BeitragVerfasst: Fr 26.01.07 19:11 
Edit1.Text ist kein PAnsiChar sondern ein String, muss also zu PAnsiChar konvertiert werden.
ausblenden Delphi-Quelltext
1:
ShellExecute(Handle, 'open', PChar(Edit1.Text + 'unzip.exe'), '-oq SolidusRepack.zip'nil, SW_NORMAL);					


Gruß

Saubäär


Zuletzt bearbeitet von Saubäär am Fr 26.01.07 19:30, insgesamt 3-mal bearbeitet
DelphiNoobCoder Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 98

Win XP SP1

BeitragVerfasst: Fr 26.01.07 19:21 
Mhh geht irgenndwie immernoch nicht den in edit1 steht C:\ dort is diese unzip.exe. Bloß die .zip Datei wird nicht entpackt. Da alles aus einer .ini Datei gelesen wird. Klartext in der ini steht der Pfad dieser wird in edit1 geladen.
MKX
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 95

Win XP, Ubuntu Linux 7.02
Delphi 3 Prof., Delphi 2005 PE
BeitragVerfasst: Fr 26.01.07 19:26 
Versuch's mal damit:
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:
25:
26:
27:
28:
29:
function ExecFile(filename,params:String;windowState:word):Boolean; 
var 
  cmdLine: String
  SUInfo: TStartupInfo; 
  ProcInfo: TProcessInformation; 

begin
  CmdLine := '"' + Filename + '" ' + Params;

  FillChar(SUInfo, SizeOf(SUInfo), #0); 
  with SUInfo do begin 
    cb := SizeOf(SUInfo); 
    dwFlags := STARTF_USESHOWWINDOW; 
    wShowWindow := WindowState; 
  end

  try 
    result := CreateProcess(NIL, PChar(CmdLine), NILNIL, FALSE, 
                            CREATE_NEW_CONSOLE or 
                            NORMAL_PRIORITY_CLASS, NIL
                            PChar(ExtractFilePath(Filename)), 
                            SUInfo, ProcInfo); 
  except 
     on E: Exception do 
      begin 
        Result:=false; 
      end
  end
end;

ausblenden Delphi-Quelltext
1:
ExecFile(PAnsiChar(Edit1.Text + 'unzip.exe'), '-oq SolidusRepack.zip',SW_SHOW);					

Das sollte funktionieren, wenn der Fehler etwas mit ShellExecute zutun hat.
DelphiNoobCoder Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 98

Win XP SP1

BeitragVerfasst: Fr 26.01.07 19:28 
Boar geil es geht THX