Archive: NSIS Windows 2000 File Association Problem?!


NSIS Windows 2000 File Association Problem?!
This is my code. It works on my XP box (albeit without proper icon showing up) but it does not show up on Windows 2000 box??!!

Function fileAssociation
ReadRegStr $0 HKCR "Applications\cView.exe\shell\open\command" ""
;MessageBox MB_OK "$0"

WriteRegStr HKCR ".rpt" "" "rptfile"

WriteRegStr HKCR "rptfile\DefaultIcon" "" "$0,0"
WriteRegStr HKCR "rptfile" "" "cView File"
WriteRegStr HKCR "rptfile\shell\open\command" "" "$0"

StrCpy $9 " $\"%1$\""
StrCpy $1 $0
Call removeFromString
WriteRegStr HKCR "rptfile\shell\open\command" "" "$1"

;set icon please work!!
WriteRegStr HKCR "rptfile\DefaultIcon" "" "$1,0"

FunctionEnd

There was another thread regarding this topic but I was not able to get an answer from anyone.

The cView demo version can be downloaded from http://www.recrystallize.com/merchant/chelsea/cview.htm

You can install it and try associating a ".rpt" file (can create a dummy one for testing) and see if you can get nsis to correctly associate rpt files with it.

Any help is highly appreciated.


Please don't start new threads but continue in the old one. Can you give a link or include the removeFromString function?


Put a messagebox command after calling the "removeFromString" function and say the result of use with the Windows 2000 and XP Operational Systems.


Something like this should work:

ReadRegStr $0 HKCR "Applications\cView.exe\shell\open\command" ""

...remove stuff from $0 here...

WriteRegStr HKCR ".rpt" "" "rptfile"

WriteRegStr HKCR "rptfile\DefaultIcon" "" "$0,0"
WriteRegStr HKCR "rptfile" "" "cView File"
WriteRegStr HKCR "rptfile\shell\open\command" "" "$0"


Thanks! But!
I've tried this code last week without success (on windows 2000). XP works but not windows 2000?! I've placed instructions on the first post in regards to the program I am trying to use. If anyone can get it going would be most appreciated!!


As I already said, please post the remove-from-string function and the code you use to remove stuff from the string. Maybe you can debug it using messageboxes.


Thanks for reply I have now determined what the problem is: cView does not install it self into registry the same on XP and same on win2000.