|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
1200+ fellow developers rate and compare features of the top IDEs, like Visual Studio, Eclipse, RAD, Delphi and others, across 13 categories. Enjoy this FREE Download of the IDE User Satisfaction Study by Evans Data Corporation. Download Now!
|
|
#1
|
|||
|
|||
|
File association code
I finally got my own file association code sorted out and it works with every type I have tried so far.
However, I wouldn't mind someone else taking a glance at it to see if they can spot any obvious problems that I haven't. It is designed to work with my media player, Hypercube and the param can be any file ext such as avi, mpg, mp3 etc. RegisterFileType('avi'); procedure RegisterFileType(EN:String); var reg:TRegistry; begin EN:=UpperCase(EN); reg := TRegistry.Create; try reg.RootKey:=HKEY_CLASSES_ROOT; reg.OpenKey('HyperCube.'+EN,True); reg.WriteString('','HyperCube Media File'); reg.CloseKey; reg.OpenKey('HyperCube.'+EN+'\DefaultIcon',True); reg.WriteString('',ParamStr(0)+',0'); reg.CloseKey; reg.OpenKey('HyperCube.'+EN+'\Shell',True); reg.WriteString('','Open'); reg.CloseKey; reg.OpenKey('HyperCube.'+EN+'\Shell\Open',True); reg.WriteString('',''); reg.CloseKey; reg.OpenKey('HyperCube.'+EN+'\Shell\Open\command',True); reg.WriteString('','"'+ParamStr(0)+'" "%1"'); reg.CloseKey; reg.OpenKey('.'+LowerCase(EN),True); reg.WriteString('','HyperCube.'+EN); reg.CloseKey; reg.RootKey:=HKEY_CURRENT_USER; reg.OpenKey('Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.'+LowerCase(EN),True); reg.WriteString('Progid','HyperCube.'+EN); reg.CloseKey; SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_IDLIST, nil, nil) ; finally reg.Free; end; end; Question is, is it safe to be let loose on other peoples computers? |
|
#2
|
|||
|
|||
|
Is there no-one on these boards who can help me out here?
Surely not! |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > Delphi Programming > File association code |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|