User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the Pascal and Delphi section within the Software Development category of DaniWeb, a massive community of 375,274 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,223 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Pascal and Delphi advertiser:
Mar 18th, 2006
Views: 2,697
Assumes the presence of Memo1 on Form1.
delphi Syntax
  1. uses Registry;
  2.  
  3. procedure TForm1.Button1Click(Sender: TObject);
  4. var
  5. reg: TRegistry;
  6. keys: TStringList;
  7. i: Integer;
  8. typename, displayname, server: string;
  9. begin
  10. memo1.Clear;
  11. reg := TRegistry.Create;
  12. try
  13. reg.rootkey := HKEY_CLASSES_ROOT;
  14. if reg.OpenKey('', False) then
  15. begin
  16. keys := TStringList.Create;
  17. try
  18. reg.GetKeyNames(keys);
  19. reg.CloseKey;
  20. {memo1.lines.addstrings(keys);}
  21. for i := 0 to keys.Count - 1 do
  22. begin
  23. if keys[i][1] = '.' then
  24. begin
  25. {this is an extension, get its typename}
  26. if reg.OpenKey(keys[i], False) then
  27. begin
  28. typename := reg.ReadString('');
  29. reg.CloseKey;
  30. if typename <> '' then
  31. begin
  32. if reg.OpenKey(typename, False) then
  33. begin
  34. displayname := reg.ReadString('');
  35. reg.CloseKey;
  36. end;
  37. if reg.OpenKey(typename + '\shell\open\command', False) then
  38. begin
  39. server := reg.ReadString('');
  40. memo1.Lines.Add(Format('Extension: "%s", Typename: "%s", Displayname:"%s"' +
  41. #13#10' Server: %s',
  42. [keys[i], typename, displayname, server]));
  43. reg.CloseKey;
  44. end;
  45. end;
  46. end;
  47. end;
  48. end;
  49. finally
  50. keys.Free;
  51. end;
  52. end;
  53. finally
  54. reg.Free
  55. end;
  56. end;
Post Comment

Only community members can submit or comment on code snippets. You must register or log in to contribute.

DaniWeb Marketplace (Sponsored Links)
All times are GMT -4. The time now is 6:06 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC