15-01-2011, 08:08 AM
تعيد الدالة قيمة أكبر من 32 إذا نجحت في تشغيل الملف
وتعيد قيمة خطأ يمكن فحصها لتحديد الخلل بأكثر دقة، مثال:
المزيد حول الدالة وأنواع الأخطاء من MSDN
WinExec تعيد قيمة أكبر من 31 عند النجاح، مثال:
المزيد من MSDN
وتعيد قيمة خطأ يمكن فحصها لتحديد الخلل بأكثر دقة، مثال:
PHP كود :
procedure ExploreTo(handle:HWND ; page:PChar);
var
Returnvalue : integer;
begin
ReturnValue := ShellExecute(handle, 'open', page, nil, nil, SW_SHOWNORMAL);
if ReturnValue <= 32 then
case Returnvalue of
0 : MessageBox(handle,'Error: Out of Memory','Error ExploreTo',0);
ERROR_FILE_NOT_FOUND: MessageBox(handle,'Error: File not found','Error ExploreTo',0);
ERROR_PATH_NOT_FOUND: MessageBox(handle,'Error: Directory not','Error ExploreTo',0);
ERROR_BAD_FORMAT : MessageBox(handle,'Fehler: Wrong format in EXE','Error ExploreTo',0);
// All other errors . See help for more ReturnValues of ShellExecute
else
MessageBox(handle,PChar('Error Nr: '+IntToStr(Returnvalue)+' in ShellExecute'),
'Error ExploreTo',0)
end //case
end;
WinExec تعيد قيمة أكبر من 31 عند النجاح، مثال:
PHP كود :
function Exec(Cmd: string; ShowConsole: Boolean): Boolean;
begin
Result := WinExec(PChar(Cmd), Ord(ShowConsole)) > 31;
end;

