hi everybody;
lately i developed a simple program that handles text files on windows .
i want to know how to make my program the default one for txt file type?
Printable View
hi everybody;
lately i developed a simple program that handles text files on windows .
i want to know how to make my program the default one for txt file type?
Qt doesn't offer any direct way to do this. You will have to use WinAPI directly or modify registry with help of QSettings.
yes, i know.
but how can i use QSettings to do that.
note that i know how to use QSettings but i do not know which key sholud i change.
and thank you for your co-operation.
See http://msdn2.microsoft.com/en-us/library/bb776847.aspx
Briefly, you should add a .ext key to HKEY_CLASSES_ROOT, then set its default value to extfile. Then add a extfile key to HKEY_CLASSES_ROOT, with subkeys DefaultIcon (default value = icon) and shell/open/command (default value = "/path/to/app %1").
See .txt and txtfile keys for an example.
Does anybody know how to open files in your program when it runs and user double clicks on the file which is associated with your program ? :confused:
Do you mean when user double clicks on a file and its associated application is already running?
You have to use some interprocess communication system. Basically, when your app starts, it must check if another instance is running, and if yes it must send it a message (i.e. open a new file).
You can use sockets, or lock files, or platform specific ways (i.e. mutexes and mailslots on windows).
Yes I do mean that :)
Thanks for reply but I've just found the way how to do it here http://www.qtcentre.org/forum/f-qt-p...nce-11824.html
Honestly I thought that I should do it the way it is described in that topic. But I thought that Qt already has this feature...