[Cf 2.0] Custom file association and default icon

S

Steve B.

Hi,

I've build an application for PPC 2003 with VS 2005 and CF 2.0.
The app have a custom icon and the exe file appears correctly in the file
explorer.

I've also created a new file association ".myapp". I associated my app with
this file extention successfully.

My problem is that I'd like to add a custom icon to my new file extention.
However, I don't know how to manage ressources to give to the system the
correct icon.

Here is the registry snippet I use :
[HKEY_CLASSES_ROOT\.myApp]
@="MyApp"

[HKEY_CLASSES_ROOT\myApp]
@=".myApp document"

[HKEY_CLASSES_ROOT\myApp\Shell]

[HKEY_CLASSES_ROOT\myApp\Shell\Open]

[HKEY_CLASSES_ROOT\myApp\Shell\Open\Command]
@="\"\\Program files\\myApp\\myApp.exe\" \"%1\""

[HKEY_CLASSES_ROOT\myApp\DefaultIcon]
@="\"\\Program files\\myApp\\myApp.exe\",1"

I suppose the "1" should correspond to one of the ressource name in the
assembly, but Visual Studio does not let me rename an icon if the ressource
"1"...


Does anyone know how to reach my goal ?

Thanks,
Steve
 
G

Giuseppe Lippolis

Hello Steve B.,
Hi,

I've build an application for PPC 2003 with VS 2005 and CF 2.0.
The app have a custom icon and the exe file appears correctly in the
file
explorer.
I've also created a new file association ".myapp". I associated my app
with this file extention successfully.

My problem is that I'd like to add a custom icon to my new file
extention. However, I don't know how to manage ressources to give to
the system the correct icon.

Here is the registry snippet I use :
[HKEY_CLASSES_ROOT\.myApp]
@="MyApp"
[HKEY_CLASSES_ROOT\myApp]
@=".myApp document"
[HKEY_CLASSES_ROOT\myApp\Shell]

[HKEY_CLASSES_ROOT\myApp\Shell\Open]

[HKEY_CLASSES_ROOT\myApp\Shell\Open\Command]
@="\"\\Program files\\myApp\\myApp.exe\" \"%1\""
[HKEY_CLASSES_ROOT\myApp\DefaultIcon]
@="\"\\Program files\\myApp\\myApp.exe\",1"
I suppose the "1" should correspond to one of the ressource name in
the assembly, but Visual Studio does not let me rename an icon if the
ressource "1"...

Does anyone know how to reach my goal ?

Thanks,
Steve

"1" refer at unmanaged ressource name.
For more information see http://msdn2.microsoft.com/en-us/library/8f2f5x2e.asp
 
S

Steve B.

Thanks for your answer.

I've created in a native application a RC file with 2 icons. I gave 0 and 1
for the IDS of the icons.
I've build the native project and a .res file has be created.
I've next added the .res file to my c# device application, and in the
project properties page, I've selected the .res file as the resource file.

In the registry, I've set up the defaulticon key's default value to \storage
card\myapp.exe,1
However, the displayed icon is still the blank icon for the .myapp files,
even if the app itself show the correct icon.

What is wrong ?

Thanks,
Steve

Giuseppe Lippolis said:
Hello Steve B.,
Hi,

I've build an application for PPC 2003 with VS 2005 and CF 2.0.
The app have a custom icon and the exe file appears correctly in the
file
explorer.
I've also created a new file association ".myapp". I associated my app
with this file extention successfully.

My problem is that I'd like to add a custom icon to my new file
extention. However, I don't know how to manage ressources to give to
the system the correct icon.

Here is the registry snippet I use :
[HKEY_CLASSES_ROOT\.myApp]
@="MyApp"
[HKEY_CLASSES_ROOT\myApp]
@=".myApp document"
[HKEY_CLASSES_ROOT\myApp\Shell]

[HKEY_CLASSES_ROOT\myApp\Shell\Open]

[HKEY_CLASSES_ROOT\myApp\Shell\Open\Command]
@="\"\\Program files\\myApp\\myApp.exe\" \"%1\""
[HKEY_CLASSES_ROOT\myApp\DefaultIcon]
@="\"\\Program files\\myApp\\myApp.exe\",1"
I suppose the "1" should correspond to one of the ressource name in
the assembly, but Visual Studio does not let me rename an icon if the
ressource "1"...

Does anyone know how to reach my goal ?

Thanks,
Steve

"1" refer at unmanaged ressource name.
For more information see
http://msdn2.microsoft.com/en-us/library/8f2f5x2e.aspx
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top