2015-04-02 86 views
1

使用此功能來保存安裝從nsis website顯示NSISNSIS INTALLER:LVM_GETITEMCOUNT已經定義

!define LVM_GETITEMCOUNT 0x1004 
    !define LVM_GETITEMTEXT 0x102D 

    Function DumpLog 
     Exch $5 
     Push $0 
     Push $1 
     Push $2 
     Push $3 
     Push $4 
     Push $6 

     FindWindow $0 "#32770" "" $HWNDPARENT 
     GetDlgItem $0 $0 1016 
     StrCmp $0 0 exit 
     FileOpen $5 $5 "w" 
     StrCmp $5 "" exit 
     SendMessage $0 ${LVM_GETITEMCOUNT} 0 0 $6 
     System::Alloc ${NSIS_MAX_STRLEN} 
     Pop $3 
     StrCpy $2 0 
     System::Call "*(i, i, i, i, i, i, i, i, i) i \ 
      (0, 0, 0, 0, 0, r3, ${NSIS_MAX_STRLEN}) .r1" 
     loop: StrCmp $2 $6 done 
      System::Call "User32::SendMessageA(i, i, i, i) i \ 
      ($0, ${LVM_GETITEMTEXT}, $2, r1)" 
      System::Call "*$3(&t${NSIS_MAX_STRLEN} .r4)" 
      FileWrite $5 "$4$\r$\n" 
      IntOp $2 $2 + 1 
      Goto loop 
     done: 
      FileClose $5 
      System::Free $1 
      System::Free $3 
     exit: 
     Pop $6 
     Pop $4 
     Pop $3 
     Pop $2 
     Pop $1 
     Pop $0 
     Exch $5 
    FunctionEnd 

日誌,編譯安裝程序腳本時,我得到的錯誤

lvm_getitemcount already defined 

。有任何想法嗎?

回答

3

編譯器告訴你這個問題!

其他一些代碼已經定義了該符號,可能在您包含的頭文件中。

註釋掉第二個定義或檢查它是否已經被定義:

!ifndef LVM_GETITEMCOUNT 
!define LVM_GETITEMCOUNT 0x1004 
!endif 
!ifndef LVM_GETITEMTEXT 
!define LVM_GETITEMTEXT 0x102D 
!endif 
+0

我可以放心地重命名變量? – JackNova 2015-04-03 06:56:21

+1

@JackNova:它會引入一個不必要的重複。 – Seki 2015-04-03 08:27:33