source: oup/releases/0.29a3/TFileTypeRegistration/demo.txt@ 708

Last change on this file since 708 was 32, checked in by alloc, 18 years ago
File size: 1015 bytes
Line 
1uses
2 ftypesAPI;
3
4var
5 ftr : TFileTypeRegistration;
6 s:String;
7
8
9ftr := TFileTypeRegistration.Create;
10if(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;
34end;
Note: See TracBrowser for help on using the repository browser.