Autor Beitrag
Newhack
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 38



BeitragVerfasst: Sa 27.08.05 11:57 
Hallo
Ich habe eine Problem mit der procedure ShellExecute_AndWait.
Bei Delphi 7 lief sie 1a, nur jetzt bei Delphi 2005 gabs immer Probs.

Hier mal der Source:
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:
procedure ShellExecute_AndWait(FileName: string; Params: string); 
var 
 exInfo: TShellExecuteInfo; 
 Ph: DWORD; 
begin 
 FillChar(exInfo, SizeOf(exInfo), 0); 
 with exInfo do 
 begin 
   cbSize := SizeOf(exInfo); 
   fMask := SEE_MASK_NOCLOSEPROCESS or SEE_MASK_FLAG_DDEWAIT; 
   Wnd := GetActiveWindow(); 
   ExInfo.lpVerb := 'open'
   ExInfo.lpParameters := PChar(Params); 
   lpFile := PChar(FileName); 
   nShow := SW_SHOWNORMAL; 
 end
 if ShellExecuteEx(@exInfo) then 
   Ph := exInfo.HProcess 
 else 
 begin 
   ShowMessage(SysErrorMessage(GetLastError)); 
   Exit; 
 end
 while WaitForSingleObject(ExInfo.hProcess, 50) <> WAIT_OBJECT_0 do 
   Application.ProcessMessages; 
 CloseHandle(Ph); 
end;


Als fehler zeigt er mit diese Zeile an:
ausblenden Delphi-Quelltext
1:
2:
begin 
 FillChar(exInfo, SizeOf(exInfo), 0);

Mit dem FillChar kommt er nicht klar. Hat jemand eine Idee?

Danke

Moderiert von user profile iconChristian S.: Code- durch Delphi-Tags ersetzt.
Moderiert von user profile iconChristian S.: Topic aus Sonstiges verschoben am Sa 27.08.2005 um 12:00
Sprint
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 849



BeitragVerfasst: Sa 27.08.05 15:20 
Und wie lautet die Fehlermeldung?

_________________
Ciao, Sprint.
uall@ogc
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 1826
Erhaltene Danke: 11

Win 2000 & VMware
Delphi 3 Prof, Delphi 7 Prof
BeitragVerfasst: Sa 27.08.05 15:48 
ersetz das mal durch

ZeroMemory(@exInfo, SizeOf(exInfo));

_________________
wer andern eine grube gräbt hat ein grubengrabgerät
- oder einfach zu viel zeit
Sprint
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 849



BeitragVerfasst: Sa 27.08.05 16:49 
Wie auch schon unter Delphi 7 wird beim Aufruf von ZeroMemory, die interne Prozedur FillChar aufgerufen und nicht die WinAPI Funktion ZeroMemory.
Das oben gepostete Beispiel läuft unter Delphi 2005 Pro (General Update 3) fehlerfrei.

_________________
Ciao, Sprint.
Newhack Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 38



BeitragVerfasst: Sa 27.08.05 17:57 
Aber wieso läuft es bei mir nicht? Und noch andere Varianten gibt es nicht?

Fehler: [Fehler] Unit1.pas(57): E2003 Undefinierter Bezeichner: 'ZeroMemory' (oder FillChar)
Sprint
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 849



BeitragVerfasst: Sa 27.08.05 18:18 
user profile iconNewhack hat folgendes geschrieben:
Aber wieso läuft es bei mir nicht? Und noch andere Varianten gibt es nicht?

Wahrscheinlich weil du irgendwo anders einen Fehler drin hast.

_________________
Ciao, Sprint.
uall@ogc
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 1826
Erhaltene Danke: 11

Win 2000 & VMware
Delphi 3 Prof, Delphi 7 Prof
BeitragVerfasst: Sa 27.08.05 19:34 
Fillchar ist in der system.dcu/pas deklariert die sollte immer eingebunden sein

irgendwas amchst di falsch, vielleicht solltest mal delphi neuinstallieren

_________________
wer andern eine grube gräbt hat ein grubengrabgerät
- oder einfach zu viel zeit