change txt file type default icon
hello everybody,
i want to change the default icon of the txt file type on windows this can done if we chabged the following registry Key using QSettings
HKEY_CLASSES_ROOT\txtfile\DefaultIcon\Default value
and set it's value to the path of my program.
how can i do that ???
thank you.
Re: change txt file type default icon
But what's the problem? You know the registry path and you know QSettings. If you don't know how to use QSettings, go read its great docs full of examples:
http://doc.trolltech.com/latest/qset...istry-directly.
Re: change txt file type default icon
i just did as described in the documentation.
it is said in the documentation that windows keys can have default value and to change it just refer to the key as follows
Code:
settings.setValue("HKEY_CLASSES_ROOT\\txtfile\\DefaultIcon", "D:\\Work space\\MY Projects\\executable\\MyEditor.exe");
when i did that nothing happens.
where is the wrong?
Re: change txt file type default icon
What does mean "nothing happens"? Did you check the value with Regedit? Shoudn't "DefaultIcon" refer to an icon file?
Re: change txt file type default icon
Try with
Code:
settings.setValue("HKEY_CLASSES_ROOT\\txtfile\\DefaultIcon", "\"D:\\Work space\\MY Projects\\executable\\MyEditor.exe,0\"");
Re: change txt file type default icon
i tried but nothing happens the defaultIcon Key is still as it was . it was
%SystemRoot%\system32\shell32.dll,-152
and it is still.
note that i tried settings.contains() to be sure that the Key is exist and be shown by
my program and it returns true which means that the program see the Key but can not
change it i dont know why!!!
Re: change txt file type default icon
Quote:
What does mean "nothing happens"?
i mean that the key did not changed.
Quote:
Did you check the value with Regedit?
yes, i checked it . it is still as it was.
Re: change txt file type default icon
How did you create QSettings object? It should be done this way:
Code:
// Then edit subkeys.
settings.setValue("DefaultIcon", "\"D:\\Work space\\MY Projects\\executable\\MyEditor.exe,0\"");
Re: change txt file type default icon
when i did that a new key called DefaultIcon is added in the Path
HKEY_CLASSES_ROOT\\txtfile
with the value
"D:\Work space\MY Projects\executable\MyEditor.exe,0"
note the double quotation.
and thank you for your co-operation.