LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Change the file's icon of my program

hi.
how can i change the file's icon of my program when i install my program? for example when you install adobe reader all .pdf files get the adobe icon and when you uninstall adobe reader the .pdf files icon will change.
 
thanks.
ali mootab.
0 Kudos
Message 1 of 5
(3,010 Views)


@ali mootab wrote:
hi.
how can i change the file's icon of my program when i install my program? for example when you install adobe reader all .pdf files get the adobe icon and when you uninstall adobe reader the .pdf files icon will change.


You will have to modify the registry. If registry editing is not your thing I would refrain from doing this especially considering that you would do it on someone elses computer.

First you create the extension entry under:

HKEY_CLASSES_ROOT/.<ext>/                                           REG_SZ    <your file type>

Then you create the file type under:

HKEY_CLASSES_ROOT/<file type>/Default Icon/               REG_SZ     <path to the file containing the icon>,<icon index>

and then you probably want to create shell shortcuts so that double clicking your file in explorer launches your application:

HKEY_CLASSES_ROOT/<file type>/Shell/Open/Command/     REG_SZ           <path to your executable> "%1"

and then you onlu need to read the command line parameters try to interpret the parameters if any and open the passed in
file name in your applciation.

This is all not exactly without difficulties so test it throughly on your own computers a few times before distributing it to others.

Rolf Kalbermatter

Message Edited by rolfk on 04-16-2006 08:24 PM

Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
0 Kudos
Message 2 of 5
(2,995 Views)


ali mootab wrote:
how can i change the file's icon of my program when i install my program? for example when you install adobe reader all .pdf files get the adobe icon and when you uninstall adobe reader the .pdf files icon will change.

Rolf is of course correct.

(1) First you have the icon of the program, which you can set in the application builder. (LabVIEW 8.0 even includes an editor to create icons for windows executables.).

(2) Second, you seem to create a custom file type (via extension) for exclusive use by your program. Here you better do some research to make sure whatever you select does not conflict with any other existing application. For example, it would be bad to select (*.txt, *.xls, *.pdf, *.dat, etc.). 😉

(3) Once the file association is made, you also need to code your LabVIEW application to read the commandline parameters to get to the filename(s) to be opened. Once you do this, you can double-click a data file and it will open with your application. You can even drop a bunch of file ot the icon of the executable. Some instruction on how to do this can be found at the following link: http://sine.ni.com/apps/we/niepd_web_display.display_epd4?p_guid=B123AE0CBCA4111EE034080020E74861&p_...


 

0 Kudos
Message 3 of 5
(2,988 Views)
I would suggest the first approach, using the application builder, this is a very easy solution and will customize all icons in your program even the ones in the title bar.  It takes several minutes to make a nice icon suite but it is well worth it. 
Paul Falkenstein
Coleman Technologies Inc.
CLA, CPI, AIA-Vision
Labview 4.0- 2013, RT, Vision, FPGA
0 Kudos
Message 4 of 5
(2,969 Views)
I would suggest the first approach, using the application builder, this is a very easy solution and will customize all icons in your program even the ones in the title bar.  It takes several minutes to make a nice icon suite but it is well worth it. 
Paul Falkenstein
Coleman Technologies Inc.
CLA, CPI, AIA-Vision
Labview 4.0- 2013, RT, Vision, FPGA
0 Kudos
Message 5 of 5
(2,969 Views)