حفظ مسار opendialog في inifile
#7
و عليكم السلام و رحمة الله و بركاته

1- المرفق يعمل عندي عادي .
2- من رسالة الخطأ : الملف الصوتي المحدد ذو إمتداد غير مقبول .

-------------------------------------
الحل :
1- يمكن أن نضيف شرط للتحقق من إمتداد الملف عند القراءة أو التعديل مثال :
راجع http://www.delphi4arab.net/forum/showthr...595&page=1
لكي تختصر طريقة التحقق !!! .

PHP كود :
procedure TForm1.Openmusic1Click(Sender: TObject);
Const
 
SndExt : Array [0..2]Of String = ('.avi','.mp3','.wav');
begin
ClearAll
;
With TIniFile.Create(sPath),OpenDialog1 Do
 
Begin
 Execute
;
 If 
FileName = '' Then Exit;
 If (
ExtractFileExt(FileName) = SndExt[0])
  Or (
ExtractFileExt(FileName) = SndExt[1])
   Or (
ExtractFileExt(FileName) = SndExt[2]) Then
 WriteString
('OpenDclass','FileName',FileName) Else
   
MessageBox(0,'FileExt Is Not Accepted .',Nil,0);
 
End;
end; 

2- أو تسير خطأ :

[صورة: 4464.jpg]

PHP كود :
Try
  
WriteString('OpenDclass','FileName',FileName);
 
Except
 On E
:Exception Do
  
MessageBox(0,'FileExt Is Not Accepted .',Nil,0);
 
End; 

أو لاحظ نوع الخطأ المحرر EMCIDeviceError

PHP كود :
Try
  
WriteString('OpenDclass','FileName',FileName);
 
Except
 On EMCIDeviceError 
Do
  
MessageBox(0,'FileExt Is Not Accepted .',Nil,0);
 
End; 

في ما يخص الطريقة 2 :
PHP كود :
Try
  
MessageBox(0,'FileExt Is Not Accepted .',Nil,0);
 
Except
 On E
:Exception Do
  
MessageBox(0,Pchar(E.Message),Nil,0);
 
End; 

هذا للإستفادة من خصائص E فقط كملاحظة .

بالتوفيق ,,
I'M Fly Like A G6

الرد


الردود في هذا الموضوع
حفظ مسار opendialog في inifile - بواسطة paix144 - 18-12-2009, 08:50 PM
حفظ مسار opendialog في inifile - بواسطة paix144 - 04-01-2010, 12:46 AM
حفظ مسار opendialog في inifile - بواسطة TF6M - 08-01-2010, 06:21 PM
حفظ مسار opendialog في inifile - بواسطة paix144 - 08-01-2010, 08:37 PM
حفظ مسار opendialog في inifile - بواسطة TF6M - 18-12-2009, 09:52 PM
حفظ مسار opendialog في inifile - بواسطة paix144 - 18-12-2009, 10:52 PM
حفظ مسار opendialog في inifile - بواسطة TF6M - 18-12-2009, 11:47 PM
حفظ مسار opendialog في inifile - بواسطة paix144 - 19-12-2009, 12:10 AM

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


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