[Interest] Fwd: how to add the Application icon to the file which is generated from my Qt Application..... so that saved file shows the Application icon image ??????

Jaco Naude naude.jaco at gmail.com
Thu Jan 19 07:12:29 CET 2012


Hi again,

I understand what you mean and I already gave the solution in my first
reply. You need to modify the Windows registry to do this, it has nothing
to do with Qt really.

You can either modify the registry in your application or the best way to
do it is through an installer. In either case, you can see which registry
entries need to be changed in the installer script I added.

;--------------------------------
; File Associations
;--------------------------------
; Write a file association to the registry for files with extension
.yourextension files:
WriteRegStr HKCR ".yourextension" "" "YourApplication.FileDescription"
WriteRegStr HKCR "YourApplication.FileDescription" "" \
"Your Application FileDescription"
WriteRegStr HKCR "YourApplication.FileDescription\DefaultIcon" "" \
"$INSTDIR\YourApplication.exe,0"
WriteRegStr HKCR "YourApplication.FileDescription\shell\open\command" "" \
'"$INSTDIR\YourApplication.exe" "-i" "%1"'
WriteRegStr HKCR "YourApplication.FileDescription\shell\print\command" "" \
'"$INSTDIR\YourApplication.exe" /p "-i" "%1"'

See
http://msdn.microsoft.com/en-us/library/windows/desktop/ms724475(v=vs.85).aspx
for
more information. As I said, I don't know how to do this on Linux yet.

Good luck,

Jaco Naude'

Qtilities: Building blocks for Qt applications.
http://www.qtilities.org



On Thu, Jan 19, 2012 at 7:56 AM, Muthulingam Ammaiappan <
muthulingam.a at gmail.com> wrote:

> Hi Jaco Naude,
>
> Thanks for your Quick Reply...
>
> here i am not talking about to set the application icon image to the
> exe.... i had already implemented that functionality...
>
> now i am interested to add the application icon image to the file which is
> generated from my application....
>
> you can see the attached image...(in that PDF files Shows the Adobe Reader
> Icon image ,a nd MS Word files are showing MS Word Application Icon
> Image...)
>
> like that i wanted to show my application icon image to the file which is
> generated from my application...
>
> if you give some code snippet it will be really helpful...
>
> Thanks & Regards,
> Muthulingam
>
>
> On Thu, Jan 19, 2012 at 11:13 AM, Jaco Naude <naude.jaco at gmail.com> wrote:
>
>> Hi Muthulingam
>>
>> Do you mean your executable? In that case see
>> http://doc.qt.nokia.com/4.7-snapshot/appicon.html.
>>
>> If you mean that you want to associate a specific file type with your
>> application it becomes more difficult and it depends on the OS where you
>> deploy your application.
>> I have only done this on Windows and there is probably many ways to do it
>> (and this is not really a Qt question), but here is my solution:
>>
>> I create my installers using NSIS and adding the following to the
>> installer script will create a file association windows (Tested on
>> XP,Vista,7):
>>
>> ;--------------------------------
>> ; File Associations
>> ;--------------------------------
>> ; Write a file association to the registry for files with extension
>> .yourextension files:
>> WriteRegStr HKCR ".yourextension" "" "YourApplication.FileDescription"
>> WriteRegStr HKCR "YourApplication.FileDescription" "" \
>> "Your Application FileDescription"
>> WriteRegStr HKCR "YourApplication.FileDescription\DefaultIcon" "" \
>> "$INSTDIR\YourApplication.exe,0"
>> WriteRegStr HKCR "YourApplication.FileDescription\shell\open\command" "" \
>> '"$INSTDIR\YourApplication.exe" "-i" "%1"'
>> WriteRegStr HKCR "YourApplication.FileDescription\shell\print\command" ""
>> \
>> '"$INSTDIR\YourApplication.exe" /p "-i" "%1"'
>>
>> You then need to handle a command line parameter which you will receive
>> from windows when someone opens your file. In the above example it will
>> look something like this:
>> YourApplication.exe -i "File Path"
>>
>> Hope it helps,
>> Cheers
>> Jaco
>>
>>
>>
>> On Thu, Jan 19, 2012 at 7:21 AM, Muthulingam Ammaiappan <
>> muthulingam.a at gmail.com> wrote:
>>
>>> Hi Friends,
>>>
>>> I wanted to add the Application Icon image to the file which is
>>> generated from my Qt Application....
>>>
>>> so that the saved file should display the Application Icon Image.....
>>>
>>> (for example: PDF files shows the Adobe Reader Application Icon....)...
>>>
>>> can anyone help me to fix this problem????
>>>
>>> Thanks & Regards,
>>> Muthulingam
>>>
>>> _______________________________________________
>>> Interest mailing list
>>> Interest at qt-project.org
>>> http://lists.qt-project.org/mailman/listinfo/interest
>>>
>>>
>>
>>
>> --
>> Jaco Naude'
>>
>> Qtilities: Building blocks for Qt applications.
>> http://www.qtilities.org
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20120119/f952e47f/attachment.html>


More information about the Interest mailing list