Delphi Pages Forums  

Go Back   Delphi Pages Forums > Delphi Forum > General

Lost Password?

Thread Tools Display Modes
Old 04-08-2012, 11:38 PM
oggtheclever oggtheclever is offline
Junior Member
Join Date: Mar 2012
Posts: 14
Unhappy File Association and the registry

I come to you in desperation as I've been struggling with this problem all weekend. So obsessed with it have I become that I even dreamt about it last night.

My problem is this. For the past couple of months I have been creating my own media player in Delphi and I must admit that it's really coming along very nicely.

This weekend I finally got around to doing some of the options in 'preferences' and one of these was the file associations. The idea, as you expect, is that the user can select various extensions, such as .avi, .mpg, .mp3 etc.. and assign them to my programme so that the next time they double-click on one of these files it's my media player that opens and plays them and not, say, windows media player.

So far so good...

Now it seems no matter what I do, how I change the registry using examples found on various sites, whether I run the programme as an admin or not it doesn't make the slightest difference. I simply cannot change any file association to my media player.

Further imagine my utter frustration when I download media players such as Zoom Player or the DIVX Player and go into their options dialog and find that within a couple of clicks I can assign extensions to them with no problem whatsoever. What is it that they are doing that my media player isn't?

So, to cut a long story short I suppose the real question is this. What registry entries do I need to change (without having to run my app in admin mode as I didn't with Zoom Player etc.) to associate certain filetypes such as .avi with my media player that actually works under Windows 7?

Can I confine myself entirely to HKEY_CURRENT_USER for example?

Many thanks in advance
Reply With Quote
Old 04-09-2012, 02:04 PM
oggtheclever oggtheclever is offline
Junior Member
Join Date: Mar 2012
Posts: 14
Default Solved

procedure TForm1.RegisterFileType(ExtName:String);
  a: byte;


  with TRegistry.Create do


    if OpenKey('\.avi\', True) then begin
      WriteString('PerceivedType', 'video');
      WriteString('Content Type', 'video/avi');

    OpenKey('\.avi\OpenWithList\ehshell.exe\', True);

    if OpenKey('\.avi\OpenWithProgIds\', True) then
      WriteBinaryData('avifile', a, 1);

   if OpenKey('\avifile\shell\open\command\', True) then
      WriteString('', '"'+ParamStr(0)+'" "%1"');



    if OpenKey('\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.avi\OpenW​ithProgids\', True) then
      WriteBinaryData('avifile', a, 1);



Last edited by Norrit; 04-10-2012 at 10:44 AM. Reason: added code-tags
Reply With Quote

extensions, filetypes, registry, tregistry

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump

All times are GMT. The time now is 07:07 PM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2019, vBulletin Solutions, Inc.