Avatar billede justincase1089 Nybegynder
31. august 2004 - 11:39 Der er 6 kommentarer og
1 løsning

File Association

Hejsa

Hvilke entries skal der tilføjes i registreringsdatabasen for at lave file association for en given extension til et program?

MVH
  Justin Case
Avatar billede falster Ekspert
31. august 2004 - 13:35 #1
Prøv at se dette

http://www.eksperten.dk/spm/530905

evt. også om "FileAsoc"-programmet, hvis du vil gøre det via en GUI.
Avatar billede justincase1089 Nybegynder
31. august 2004 - 13:42 #2
Det er ikke videre gennemskueligt det der står i det spørgsmål ... jeg skal bruge det manuelt.
Avatar billede falster Ekspert
31. august 2004 - 13:47 #3
Jeg har selv engang gennemlæst dette. Jeg kan desværre ikke huske/finde linket, så jeg prøver med paste:

The registry entries
Each file type (extension) which has an associated application has a Registry key under HKEY_CLASSES_ROOT. The value stored with this key is the File Class. For example, the extension ".txt" may have TextFile as its File Class. The extension ".ini" could also have TextFile as its File Class. Both file types then have exactly the same set of commands.
There should be a File Class key in the HKEY_CLASSES_ROOT hive. The default value of this key is a description of the type of file, for example the key "TextFile" might have "Text file" as its default value. The "File types" dialog of Windows Explorer uses these descriptions in its list.
The Command Verbs for the File Class are listed as sub-keys of the Shell sub-key. The default value of the Shell key is the default command, if no value is set it is "open". Common examples of Verb are "open" and "edit". However, an action can be given any name; by convention letters, spaces and the underscore character are used. They are not case sensitive.
Next Windows must decide which Verb to use. If the launch request specified one then that is used. If not, it uses the default Verb in the Registry if there is one. Otherwise, the Verb "open" is assumed. If there is no entry for the Verb selected by this sequence, then the first Verb listed in the Registry is used.
Once the Verb entry has been located the Ddeexec sub-key is looked for. If it exists the Shell attempts to send the DDE Execute command to the Application and Topic specified. If this succeeds the application is already running and the operation has completed.
If the Ddeexec key does not exist or the DDE Execute failed, the Shell launches an application according to the Command sub-key of the Verb. This sub-key specifies the path of the application and the command line parameters.
After the application has started and if the Ifexec sub-key exists, the Shell attempts to send the specified DDE Execute command. If the Ifexec key is absent and the Ddeexec value is present, the Shell attempts to send that instead.
If the application does not accept the DDE connection attempted by Windows, it shows an error dialog which states that the application or one of its components cannot be found. In many cases the application has started successfully, the usual cause of the message is that the Registry should not have any DDE commands for the application.
The user can launch files with Windows Explorer. If the file is double clicked the default Verb is used. If the file is right clicked one of the popup menu items, which include all the action verbs, must be chosen. The default action (if any) is in a bold typeface. Start Wizard is a program which launches files with the Verb and/or command line you specify.
The commands themselves are in sub-keys under the command Verbs according to the following pattern. Underlined words are registry key names.
Extension, value File Class
File Class, the value is the description shown by Explorer
DefaultIcon, the value is the file and index of the default icon shown by Explorer
Shell, the value is the default Verb
Verb e.g. open. There is no default value.
Command The value is the command line to start the associated application, consisting of the application path followed by the command line parameters. "%1" is the file path to open. The command line parameters are usually different for each Verb. The application is usually the same for all the Verbs, but it need not be.
Ddeexec This key and its sub-keys are optional. The value is the default DDE Execute command string. It usually has an Application sub-key and a Topic sub-key. If there is no Ifexec sub-key, this string is used whether or not the application had to be started. If the Ifexec key is present, the Ddeexec command is used only if the application is already running.
Ifexec The value is the DDE Execute string sent to the application just after it has been started. If this key is absent, the default Ddeexec value is sent instead.
Application The DDE service name for the Shell to connect to for sending DDE Execute commands. This is frequently the same as the application name, for example "Excel" and "IExplore". Usually present if there are any DDE Execute strings for the Verb, if not Windows uses the executable name.
Topic The DDE Topic name for the Shell to connect to for sending DDE Execute commands. Defaults to "System" if this key is absent.
Verb e.g. edit
Command
Ddeexec
Ifexec
Application
Topic
Avatar billede gratis Nybegynder
31. august 2004 - 15:34 #4
Åben en kommandoprompt og kør kommandoen:

assoc .txt=notepad , dette er et eksempel
hvis man skal fjerne en assosiationen skriver man kommandoen tomt

assoc .txt=

skal det være default

assoc.txt=default
Avatar billede justincase1089 Nybegynder
31. august 2004 - 16:03 #5
gratis ... læs mit spørgsmål og min gentagelse i item 3.

falster ... ret uudførligt. Hvad med et export fra reg ... det er meget nemmere at anvende. Lad os kalde mit program GonyfProgram.exe der tager extensionen .gonyf. Den jeg kan selv finde lignende forklaringer på nettet, men de er allsammen ret teoretiske. Ikke at det gør noget, men det er altid nemmere med et eksempel.
Avatar billede falster Ekspert
31. august 2004 - 16:21 #6
Put dette i en flad fil og kald den noget med ".reg". Indlæs den - og lad os se om det virker:

REGEDIT4

[HKEY_CLASSES_ROOT\.gonyf]
@="Gonyf-fil"

[HKEY_CLASSES_ROOT\Gonyf-fil]
@="Eksperten eksempel"

[HKEY_CLASSES_ROOT\Gonyf-fil\DefaultIcon]
@="C:\\Programmer\\GonyfProgram.exe,0"

[HKEY_CLASSES_ROOT\Gonyf-fil\Shell]

[HKEY_CLASSES_ROOT\Gonyf-fil\Shell\Open]

[HKEY_CLASSES_ROOT\Gonyf-fil\Shell\Open\Command]
@="C:\\Programmer\\GonyfProgram.exe \"%1\""
Avatar billede justincase1089 Nybegynder
02. september 2004 - 13:20 #7
Perfekt
Avatar billede Ny bruger Nybegynder

Din løsning...

Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.

Loading billede Opret Preview
Kategori
IT-kurser om Microsoft 365, sikkerhed, personlig vækst, udvikling, digital markedsføring, grafisk design, SAP og forretningsanalyse.

Log ind eller opret profil

Hov!

For at kunne deltage på Computerworld Eksperten skal du være logget ind.

Det er heldigvis nemt at oprette en bruger: Det tager to minutter og du kan vælge at bruge enten e-mail, Facebook eller Google som login.

Du kan også logge ind via nedenstående tjenester