Click to See Complete Forum and Search --> : Registering file types for dialog applications


September 23rd, 1999, 10:06 AM
Hello!

I have a dialog oriented application which can load/save a special file type.

I was wondering how to register this file type in the registry so that a double click on this file type starts my app. I thought about a "reg" file to add some keys in the registry... But then how do you retrieve the filename in the InitInstance of the app?

Do you have any idea or starting point?

Thanks, Teymour

February 11th, 2000, 11:37 AM
Hey there, Teymour!


I`m not sure if this is 100% correct way, but it works with me.
Create a *.REG file and insert these kinda lines into it:
(*.BN is filetype)

REGEDIT4

[HKEY_CLASSES_ROOT\.BN]
@="BNfile"

[HKEY_CLASSES_ROOT\BNfile]
@="SoP BN - Batallion setup"
"EditFlags"=hex:00,00,00,00

[HKEY_CLASSES_ROOT\BNfile\shell]
@=""

[HKEY_CLASSES_ROOT\BNfile\shell\open]
@=""
"EditFlags"=hex:01,00,00,00

[HKEY_CLASSES_ROOT\BNfile\shell\open\command]
@="C:\\PROGRA~1\\ACCESS~1\\WORDPAD.EXE \"%1\""

[HKEY_CLASSES_ROOT\BNfile\DefaultIcon]
@="E:\\SIEGE of POWER\\Icon WGROUP.ico,0"

[HKEY_LOCAL_MACHINE\Software\CLASSES\.BN]
@="BNfile"

[HKEY_LOCAL_MACHINE\Software\CLASSES\BNfile]
@="SoP BN - Batallion setup"
"EditFlags"=hex:00,00,00,00

[HKEY_LOCAL_MACHINE\Software\CLASSES\BNfile\shell]
@=""

[HKEY_LOCAL_MACHINE\Software\CLASSES\BNfile\shell\open]
@=""
"EditFlags"=hex:01,00,00,00

[HKEY_LOCAL_MACHINE\Software\CLASSES\BNfile\shell\open\command]
@="C:\\PROGRA~1\\ACCESS~1\\WORDPAD.EXE \"%1\""

[HKEY_LOCAL_MACHINE\Software\CLASSES\BNfile\DefaultIcon]
@="E:\\SIEGE of POWER\\Icon WGROUP.ico,0"



The default selections are marked in hex flags.
It is there defined, that this file is opened with WORDPAD.
"C:\\PROGRA~1\\ACCESS~1\\WORDPAD.EXE \"%1\"

You can enter here your own pogram name. When you`ll choose to edit your file type with this program of yours, your program will receive this line inside the "lpszCmdLine" variable:

"DRIVE:\Path...\File.EXT"

You`ll have to deal with doublequotes, etc.
That`s it.

Good luck!