Sign in to follow this  
Followers 0
orange

Automatic File Association?

15 posts in this topic

Ok, so here is the issue. I have a program that writes proprietary files for its own use. These are stored with the extention *.GPH

Now, here are two questions. First: when writing the basic installer is there any way to automatically assign that file extention to be opened with my program?

Second, what fucntion do I need to write in order to have the file be opened with a double click? I already have an openfile function that is passed the filepath from the FileOpenDialog() -- do I use this somehow?

any help is appreciated

Share this post


Link to post
Share on other sites



file extension is my expertise :D

add me to msn and i'll help you trough it (i'm not gonna do it here, since its some danger register stuff)


*If u thought life couldn't get worse, u meet me *<guy> What would you give my little sister to unzip ?<friend> 10 bucks<guy> No, i mean like Winzip...

Share this post


Link to post
Share on other sites

Some of these websites helped me when I began to build an installer . . .

Fundamentals of Designing User Interaction: http://msdn.microsoft.com/library/default..../html/part1.asp

Designing Installation Programs: http://msdn.microsoft.com/library/default..../html/ch11d.asp

Registering a New File Type: http://msdn.microsoft.com/library/default...._file_types.asp

Creating a File Association: http://msdn.microsoft.com/library/default....s/fileassoc.asp

:D


Das Häschen benutzt Radar

Share this post


Link to post
Share on other sites

Some of these websites helped me when I began to build an installer . . .

Fundamentals of Designing User Interaction: http://msdn.microsoft.com/library/default..../html/part1.asp

Designing Installation Programs: http://msdn.microsoft.com/library/default..../html/ch11d.asp

Registering a New File Type: http://msdn.microsoft.com/library/default...._file_types.asp

Creating a File Association: http://msdn.microsoft.com/library/default....s/fileassoc.asp

:D

ill take a look -- thanks

Share this post


Link to post
Share on other sites

file extension is my expertise :whistle:

add me to msn and i'll help you trough it (i'm not gonna do it here, since its some danger register stuff)

Because that makes sense.


AutoIt Scripts:Aimbot: Proof of Concept - PixelSearching Aimbot with several search/autoshoot/lock-on techniques.Sliding Toolbar - Add a nice Sliding Toolbar to your next script. Click the link to see an animation of it in action!FontInfo UDF - Get list of system fonts, or search to see if a particular font is installed.Get Extended Property UDF - Retrieve a files extended properties (e.g., video/image dimensions, file version, bitrate of song/video, etc)

Share this post


Link to post
Share on other sites

Because that makes sense.

What you don't understand it?!

:whistle::):)

Glad to know i'm not alone

Share this post


Link to post
Share on other sites

Ok, so here is the issue. I have a program that writes proprietary files for its own use. These are stored with the extention *.GPH

Now, here are two questions. First: when writing the basic installer is there any way to automatically assign that file extention to be opened with my program?

Second, what fucntion do I need to write in order to have the file be opened with a double click? I already have an openfile function that is passed the filepath from the FileOpenDialog() -- do I use this somehow?

any help is appreciated

I think more people want to know the fine things about this. I would say if someone don't know what he is doing it is his problem. If someone typed on the internet that you activate your windows by typing in a dos prompt to delete your NTLDR file in your C:\ root, you would do it?

Those people are foolish and must stop doing if they don't know what they are doing.

In simple way, just post it here.

Share this post


Link to post
Share on other sites

o well, i'll post this stuff for u tomorrow, i wanted to test the save way first XD since i haven't used the trick for a lock time.

for those who wanna try it out themselfs

goto HKEY_local\software\classes

something like that, there is all u need, look for .mp3 and winamp.file for an example


*If u thought life couldn't get worse, u meet me *<guy> What would you give my little sister to unzip ?<friend> 10 bucks<guy> No, i mean like Winzip...

Share this post


Link to post
Share on other sites

Ok, so here is the issue. I have a program that writes proprietary files for its own use. These are stored with the extention *.GPH

Now, here are two questions. First: when writing the basic installer is there any way to automatically assign that file extention to be opened with my program?

Second, what fucntion do I need to write in order to have the file be opened with a double click? I already have an openfile function that is passed the filepath from the FileOpenDialog() -- do I use this somehow?

any help is appreciated

Hm.. If I wanted to know that, what would I do.... ???

I guess, I would associate a new file extension to notepad.exe and search the registry for the extension string and then I would get this (BTW: Extension is .ghx).

[HKEY_CLASSES_ROOT\.ghx]
@="ghx_auto_file"


[HKEY_CLASSES_ROOT\ghx_auto_file]
@=""

[HKEY_CLASSES_ROOT\ghx_auto_file\shell]

[HKEY_CLASSES_ROOT\ghx_auto_file\shell\edit]

[HKEY_CLASSES_ROOT\ghx_auto_file\shell\edit\command]
@=hex(2):25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,6f,00,74,00,25,\
  00,5c,00,73,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,00,4e,00,4f,00,\
  54,00,45,00,50,00,41,00,44,00,2e,00,45,00,58,00,45,00,20,00,25,00,31,00,00,\
  00

[HKEY_CLASSES_ROOT\ghx_auto_file\shell\open]

[HKEY_CLASSES_ROOT\ghx_auto_file\shell\open\command]
@=hex(2):25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,6f,00,74,00,25,\
  00,5c,00,73,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,00,4e,00,4f,00,\
  54,00,45,00,50,00,41,00,44,00,2e,00,45,00,58,00,45,00,20,00,25,00,31,00,00,\
  00


[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.ghx]

[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.ghx\OpenWithList]
"a"="NOTEPAD.EXE"
"MRUList"="a"

[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.ghx\OpenWithProgids]
"ghx_auto_file"=hex(0):


[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\RecentDocs\.ghx]
"0"=hex:74,00,65,00,73,00,74,00,2e,00,67,00,68,00,78,00,00,00,4c,00,32,00,00,\
  00,00,00,00,00,00,00,00,00,74,65,73,74,2e,67,68,78,2e,6c,6e,6b,00,00,30,00,\
  03,00,04,00,ef,be,00,00,00,00,00,00,00,00,14,00,00,00,74,00,65,00,73,00,74,\
  00,2e,00,67,00,68,00,78,00,2e,00,6c,00,6e,00,6b,00,00,00,1c,00,00,00
"MRUListEx"=hex:00,00,00,00,ff,ff,ff,ff


[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\.ghx]
@="ghx_auto_file"


[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\ghx_auto_file]
@=""

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\ghx_auto_file\shell]

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\ghx_auto_file\shell\edit]

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\ghx_auto_file\shell\edit\command]
@=hex(2):25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,6f,00,74,00,25,\
  00,5c,00,73,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,00,4e,00,4f,00,\
  54,00,45,00,50,00,41,00,44,00,2e,00,45,00,58,00,45,00,20,00,25,00,31,00,00,\
  00

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\ghx_auto_file\shell\open]

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\ghx_auto_file\shell\open\command]
@=hex(2):25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,6f,00,74,00,25,\
  00,5c,00,73,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,00,4e,00,4f,00,\
  54,00,45,00,50,00,41,00,44,00,2e,00,45,00,58,00,45,00,20,00,25,00,31,00,00,\
  00

Now I would use RegWrite() to add the above values to the registry.

Probably you'll have to set some values also for HKEY_USERS. Check it with regedit.

Cheers

Kurt


__________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf *

Share this post


Link to post
Share on other sites

whats with all the hex stuff ?? -.-

i don't think thats needed


*If u thought life couldn't get worse, u meet me *<guy> What would you give my little sister to unzip ?<friend> 10 bucks<guy> No, i mean like Winzip...

Share this post


Link to post
Share on other sites

whats with all the hex stuff ?? -.-

i don't think thats needed

Add those keys to your registry and view them with regedit. You'll will see, that they are indeed needed!

Cheers

Kurt


__________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf *

Share this post


Link to post
Share on other sites

but i mean, i did the same thing with an easyer way and no hex needed.

(if only i could find that DAMN installer i made)


*If u thought life couldn't get worse, u meet me *<guy> What would you give my little sister to unzip ?<friend> 10 bucks<guy> No, i mean like Winzip...

Share this post


Link to post
Share on other sites

but i mean, i did the same thing with an easyer way and no hex needed.

(if only i could find that DAMN installer i made)

Just check it with regedit! It's simply the path to the associated executable, so I see no way how it should work without that information !??!

BTW: I'm eager to see your installer....

Cheers

Kurt


__________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf *

Share this post


Link to post
Share on other sites

A simple UDF that uses ftype and assoc. Using these will refresh the shell when used, so your icons and such refresh with the changes.

Func _FiletypeAssociation($extension, $type, $program, $description = '')
    ; e.g. _FiletypeAssociation('.pdf', 'FoxitReader.Document', '"%ProgramFiles%\FoxitReader.exe" "%1"')
    $exitcode = RunWait(@ComSpec & ' /c ftype ' & $type & '=' & $program & _
             ' && assoc ' & $extension & '=' & $type, '', @SW_HIDE)
    If $description And Not $exitcode Then
        Return RegWrite('HKCR\' & $type, '', 'Reg_sz', $description)
    EndIf
    Return Not $exitcode
EndFunc

:whistle:

Share this post


Link to post
Share on other sites

#15 ·  Posted (edited)

A simple UDF that uses ftype and assoc. Using these will refresh the shell when used, so your icons and such refresh with the changes.

Nice, I did not know ftype and assoc :whistle:

Cheers

Kurt

Edited by /dev/null

__________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf *

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0