المشاركات : 6
المواضيع 3
:
: 0
الإنتساب : Oct 2010
02-07-2011, 07:33 PM
(آخر تعديل لهذه المشاركة: 16-05-2016, 02:09 PM بواسطة محمد عبد العزيز.)
السلام عليكم و رحمة الله و بركاته
- كيفية فتح ملف بإمتداد معين بالنقر عليه مرتين مثل الوورد 'Word'
- كيفية الحفاظ على التغييرات المدرجة فيه
أحبكم في الله و السلام عليكم
المشاركات : 2,293
المواضيع 157
:
: 81
الإنتساب : Dec 2008
وعليكم السلام ورحمة الله وبركاته
PHP كود :
uses
Registry;
procedure AddFileMenu(FilePrefix, Menue, Command: string);
var
reg: TRegistry;
typ: string;
begin
reg := TRegistry.Create;
with reg do
begin
RootKey := HKEY_CLASSES_ROOT;
OpenKey('.' + FilePrefix, True);
typ := ReadString('');
if typ = '' then
begin
typ := Fileprefix + 'file';
WriteString('', typ);
end;
CloseKey;
OpenKey(typ + '\shell\' + Menue + '\command', True);
WriteString('', command + ' "%1"');
CloseKey;
Free;
end;
end;
procedure DeleteFileMenu(FilePrefix, Menue: string);
var
reg: TRegistry;
typ: string;
begin
reg := TRegistry.Create;
with reg do
begin
RootKey := HKEY_CLASSES_ROOT;
OpenKey('.' + FilePrefix, True);
typ := ReadString('');
CloseKey;
OpenKey(typ + '\shell', True);
DeleteKey(Menue);
CloseKey;
Free;
end;
end;
مثال للاستخدام: لاحقة EXE
PHP كود :
if MessageBox(Handle, PChar('Would you like really add '+Application.Title+' to ShellMenu?'),
'Confirm', MB_YESNO + MB_ICONQUESTION) = IDYES then
AddFileMenu('exe', 'Edit with '+Application.Title, Application.ExeName);
للحذف:
PHP كود :
if MessageBox(Handle, PChar('Do you want to remove '+Application.Title+' from ShellMenu?'),
'Confirm', MB_YESNO + MB_ICONQUESTION) = IDYES then
DeleteFileMenu('exe', 'Edit with '+Application.Title);
هذا في Windows في Linux حيث لا وجود لـ Registry لا أعرف!
أفرد لكل سؤال موضوع
بالتوفيق.