내 nsi 스크립트에 ${NSD_CreateIPaddress}
상자를 추가했지만 각 IP 필드의 유효성을 검사하는 동안 기본값은 0
입니다. ${GetText}
을 사용하여 IP 주소 값을 가져옵니다.NSIS : IP 주소 확인 방법 상자
기본값 인 0
을 제거하고 IP 주소의 각 필드의 유효성을 검사 할 수있는 방법이 있습니까? 제발 도와주세요.
내 nsi 스크립트에 ${NSD_CreateIPaddress}
상자를 추가했지만 각 IP 필드의 유효성을 검사하는 동안 기본값은 0
입니다. ${GetText}
을 사용하여 IP 주소 값을 가져옵니다.NSIS : IP 주소 확인 방법 상자
기본값 인 0
을 제거하고 IP 주소의 각 필드의 유효성을 검사 할 수있는 방법이 있습니까? 제발 도와주세요.
나는 당신이 무엇을 요구하고 있는지 정말로 모르겠습니다. 공백 주소와 유효한 "0.0.0.0"주소의 차이를 알려면 IPM_ISBLANK
메시지를 사용할 수 있습니다. 이 이미 0..255로 제한되기 때문에 개별 필드의 유효성을 검사 할 필요 없어야하고 여전히 개별 필드보고 할 필요를 느낀다면 당신도 IPM_SETRANGE
.
와 사용자 지정 범위를 설정할 수 있습니다 할 수 있습니다
A) $ {NSD_GetText}에서 가져온 문자열을 수동으로 구문 분석하십시오.
또는
B)의 포장을 풀고 당신이 IPM_GETADDRESS
에서 얻을 32 비트 주소 :
Page Custom myPage myPageLeave
Page InstFiles
!include nsDialogs.nsh
; Using custom version of http://nsis.sourceforge.net/NsDialogs_CreateIPaddress
!ifndef NSD_CreateIPaddress
!define NSD_CreateIPaddress "!insertmacro NSD_CreateIPaddress "
!include LogicLib.nsh
!include WinMessages.nsh
!ifndef ICC_INTERNET_CLASSES
!define ICC_INTERNET_CLASSES 0x00000800
!endif
Function CCInitIP
!insertmacro _LOGICLIB_TEMP
System::Call '*(i8,i${ICC_INTERNET_CLASSES})p.s' ; NSIS 2.50+
System::Call 'COMCTL32::InitCommonControlsEx(pss)'
Pop $_LOGICLIB_TEMP
System::Free $_LOGICLIB_TEMP
FunctionEnd
!macro NSD_CreateIPaddress x y w h t
!insertmacro _LOGICLIB_TEMP
Call CCInitIP
nsDialogs::CreateControl "SysIPAddress32" ${DEFAULT_STYLES}|${WS_TABSTOP} 0 ${x} ${y} ${w} ${h} "${t}"
Exch $0
CreateFont $_LOGICLIB_TEMP "$(^Font)" "$(^FontSize)"
SendMessage $0 ${WM_SETFONT} $_LOGICLIB_TEMP 1
Exch $0
!macroend
!define /math IPM_GETADDRESS ${WM_USER} + 102
!define /math IPM_ISBLANK ${WM_USER} + 105
!endif
Function OnIPNotify ; This function displays some information about the IP
Pop $0 ; Not used
${NSD_GetText} $1 $3
StrCpy $4 "NSD_GetText: $3"
SendMessage $1 ${IPM_ISBLANK} 0 0 $0
StrCpy $4 "$4$\nIPM_ISBLANK: $0"
System::Call 'USER32::SendMessage(pr1, i ${IPM_GETADDRESS}, p 0, *i0 r3)p.r0' ; NSIS 2.50+
IntFmt $5 "0x%.8x" $3
StrCpy $4 "$4$\nIPM_GETADDRESS: ValidFields=$0 PackedIP=$5"
IntOp $0 $3 >> 24
IntOp $0 $0 & 0xff
StrCpy $4 "$4$\n$\t Field1=$0"
IntOp $0 $3 >> 16
IntOp $0 $0 & 0xff
StrCpy $4 "$4$\n$\t Field2=$0"
IntOp $0 $3 >> 8
IntOp $0 $0 & 0xff
StrCpy $4 "$4$\n$\t Field3=$0"
IntOp $0 $3 & 0xff
StrCpy $4 "$4$\n$\t Field4=$0"
${NSD_SetText} $2 $4
FunctionEnd
Function myPage
nsDialogs::Create 1018
Pop $0
${NSD_CreateIPaddress} 1% 0 50% 12u ""
Pop $1
${NSD_CreateLabel} 1% 20u 98% -20u "Enter an IP address to see information here..."
Pop $2
${NSD_OnNotify} $1 OnIPNotify ; Display some information when the control is changed
nsDialogs::Show
FunctionEnd
Function myPageLeave
Push 0
Call OnIPNotify
MessageBox mb_ok $4
FunctionEnd
는'휴가 함수에서'$ {gettext를}인가? 스크립트의 * 최소 * 예를 추가하십시오. – idleberg