02-07-2011, 09:16 PM
وعليكم السلام ورحمة الله وبركاته
مثال للاستخدام: لاحقة EXE
للحذف:
هذا في Windows في Linux حيث لا وجود لـ Registry لا أعرف!
أفرد لكل سؤال موضوع
بالتوفيق.
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;
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);
أفرد لكل سؤال موضوع
بالتوفيق.

