Announcement

Collapse
No announcement yet.

File Association / What am I doing wrong? WinXP vs. Win2K

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • File Association / What am I doing wrong? WinXP vs. Win2K

    This piece of code seems to work on my XP box while on windows 2000 it does not?? I am also having trouble in picking up the appropriate icon from the cView (third party app). Help?!

  • #2
    The Code (I forgot to attach)

    Function fileAssociation
    ;create file association
    ReadRegStr $0 HKCR "Applications\cView.exe\shell\open\command" ""

    StrCpy $9 " $\"%1$\""
    StrCpy $1 $0
    ; remove end characters
    Call removeFromString

    ; remove inital quote
    StrCpy $9 "$\""
    Call removeFromString

    ; remove end quote
    StrCpy $9 "$\""
    Call removeFromString

    WriteRegStr HKCR ".rpt" "" "Applications\cView.exe"
    WriteRegStr HKCR ".rpt\DefaultIcon" "" $1,0

    WriteRegStr HKCR "Applications\cView.exe" "" "cView File"
    WriteRegStr HKCR "Applications\cView.exe\shell" "" "open"
    FunctionEnd

    Comment


    • #3
      Try this code

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

      WriteRegStr HKCR ".rpt" "" "rptfile"

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

      Comment


      • #4
        See the thing is that the following line:
        ReadRegStr $0 HKCR "Applications\cView.exe\shell\open\command" ""

        returns something like this "c:\Profram Files\prog.exe" "%1"

        That is why I have to trim it out...

        Should I try your code anyways?

        Comment


        • #5
          You don't have to trim it. Try my code.

          Comment


          • #6
            Didn't work

            When I tried to click on a rpt file a windows dialog box opened and asked me with which application I would like to open the file.

            Comment


            • #7
              What is the value of $0? Is the icon ok?

              Comment


              • #8
                $0 = "C:\Program Files\cView\cView.exe" "%1"

                Comment


                • #9
                  Icon is not OK either

                  see title

                  Comment


                  • #10
                    I made a typo in the code. Replace rtpfile by rptfile in the last 3 lines.

                    Comment


                    • #11
                      Almost there!!

                      It seems to start the acView application but!! it does not open the rpt file?!

                      I think there might be a problem with the input parameter "%1" somewhere??

                      Comment


                      • #12
                        What is the value of HKCR, rtpfile\shell\open\command

                        Comment


                        • #13
                          it is same as the one above:

                          $1 = "C:\Program Files\cView\cView.exe" "%1"

                          Comment


                          • #14
                            Try to open it manually using the command line. Does that work?

                            Comment


                            • #15
                              when I do start run: C:\Program Files\cView\cView.exe

                              works like a charm and opens up!
                              but when I do something like this:

                              C:\Program Files\cView\cView.exe file.rpt
                              it does not open the file

                              funny thing is that if I manually set it up (association) it opens the file.

                              Comment

                              Working...
                              X
                              😀
                              🥰
                              🤢
                              😎
                              😡
                              👍
                              👎