#include once "window9.bi"

Sub SetIpAddress(ByVal gadget As Long, ByRef IP_ADDRESS As USTRING) export
	dim  As USTRING ss1,ss2,ss3,ss4
	Dim pos_ As integer
	Dim posFI_ As Integer
	Dim by As UByte
	pos_=InStr(IP_ADDRESS,".") : ss1=Mid(IP_ADDRESS,1,pos_-1)
	posFI_=InStr(pos_+1,IP_ADDRESS,"."): ss2=Mid(IP_ADDRESS,pos_+1,posFI_-pos_-1)
	Pos_= posFI_
	posFI_=InStr(pos_+1,IP_ADDRESS,"."): ss3=Mid(IP_ADDRESS,pos_+1,posFI_-pos_-1)
	ss4= Mid(IP_ADDRESS,posFI_+1)
	by=val(ss1)
	ss1=str(Hex(by)): If Len(ss1)=1 Then ss1= "0" & ss1
	by=val(ss2)
	ss2=str(Hex(by)): If Len(ss2)=1 Then ss2= "0" & ss2
	by=val(ss3)
	ss3=str(Hex(by)): If Len(ss3)=1 Then ss3= "0" & ss3
	by=val(ss4)
	ss4=str(Hex(by)): If Len(ss4)=1 Then ss4= "0" & ss4
	ss1="&h" & ss1 & ss2 & ss3 & ss4
	#ifdef UNICODE
		SendMessage(GadgetID(gadget),IPM_SETADDRESS,0,ValInt(**ss1))
	#else
		SendMessage(GadgetID(gadget),IPM_SETADDRESS,0,ValInt(ss1))
	#EndIf
End Sub
