كيف يمكن التحقق من ملف اذا كان موجود لايتم انشاءه
#4
إضافة إستخراج مسار Windows Directory كما قال onexite
تصحيح الكود:
PHP كود :
function GetWinDir: string;
var
  
dir: array [0..MAX_PATH] of Char;
begin
  GetWindowsDirectory
(dir, MAX_PATH);
  
Result := StrPas(dir);
end;

var
  
Res: TResourceStream;
begin
  
if FileExists(GetWinDir + '\1.txt') then
  begin
    ShellExecute
(0, 'open', PChar(GetWinDir + '\1.txt'), nil, nil, SW_SHOWNORMAL);
  
end
  
else
  
begin
    Res 
:= TResourceStream.Create(hInstance, 'Resource_1', RT_RCDATA);
    try
      
Res.SaveToFile(GetWinDir + '\1.txt');
      
ShellExecute(0, 'open', PChar(GetWinDir + '\1.txt'), nil, nil, SW_SHOWNORMAL);
    finally
      
Res.Free;
    
end;
  
end;
end; 
سبحان الله وبحمده سبحان الله العظيم
الرد


الردود في هذا الموضوع
كيف يمكن التحقق من ملف اذا كان موجود لايتم انشاءه - بواسطة Agmcz - 30-06-2015, 04:40 PM

التنقل السريع :


يقوم بقرائة الموضوع: بالاضافة الى ( 1 ) ضيف كريم