Rev | Line | |
---|
[33] | 1 | uses
|
---|
| 2 | ftypesAPI;
|
---|
| 3 |
|
---|
| 4 | var
|
---|
| 5 | ftr : TFileTypeRegistration;
|
---|
| 6 | s:String;
|
---|
| 7 |
|
---|
| 8 |
|
---|
| 9 | ftr := TFileTypeRegistration.Create;
|
---|
| 10 | if(ftr <> nil) then begin
|
---|
| 11 | try
|
---|
| 12 | if(LOWORD(wp) = IDC_CREATEFOO) then begin
|
---|
| 13 | if(ftr.RegisterType('.foo','FooFile','FOO-File')) then begin
|
---|
| 14 | ftr.AddHandler('open','notepad.exe "%1"','Öffnen');
|
---|
| 15 | ftr.AddHandler('print','notepad.exe /p "%1"');
|
---|
| 16 | ftr.SetDefaultHandler;
|
---|
| 17 | ftr.AddNewFileSupport('.foo');
|
---|
| 18 | end;
|
---|
| 19 | end;
|
---|
| 20 | if(LOWORD(wp) = IDC_DELPRINTVERB) then begin
|
---|
| 21 | if(ftr.GetInternalKey('.foo') <> '') then begin
|
---|
| 22 | ftr.DeleteHandler('print');
|
---|
| 23 | ftr.SetDefaultHandler('open');
|
---|
| 24 | end;
|
---|
| 25 | end;
|
---|
| 26 | if(LOWORD(wp) = IDC_REMOVEFOO) then begin
|
---|
| 27 | s := ftr.GetInternalKey('.foo');
|
---|
| 28 | if(MessageBox(hwndDlg,pchar('Wollen Sie wirklich ".foo" und "' + s + '" entfernen?'), 'Frage',MB_YESNO or MB_DEFBUTTON2 or MB_ICONQUESTION) = ID_YES) then
|
---|
| 29 | ftr.UnregisterType('.foo');
|
---|
| 30 | end;
|
---|
| 31 | finally
|
---|
| 32 | ftr.Free;
|
---|
| 33 | end;
|
---|
| 34 | end;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.