Wenn es darum geht, die IP-Adressen der Netzwerkkarten abzufragen, dann hilft vielleicht dieser Code:
Code: Alles auswählen
EnableExplicit
;- Window Constants
;
Enumeration
#Window_0
EndEnumeration
;- Gadget Constants
;
Enumeration
#Container_0
#Text_0
#Text_1
#Text_2
#Text_3
#Text_4
#Text_5
EndEnumeration
;- Fonts
Global FontID1
FontID1 = LoadFont(1, "Arial", 10, #PB_Font_Bold)
Procedure.s GetUserName()
Define UserName.s
Define Size.l
Size = 32
UserName = Space(Size)
GetUserName_(@UserName, @Size)
ProcedureReturn LCase(UserName)
EndProcedure
Procedure.s GetIPAddress()
Define Ip
Define Result.s
ExamineIPAddresses()
Ip = NextIPAddress()
While Ip
Result = IPString(Ip) + "|"
Ip = NextIPAddress()
Wend
ProcedureReturn Result
EndProcedure
Procedure OpenWindow0(IPAddress.s)
Define IPs.l
IPs = CountString(IPAddress, "|")
If IPs = 0
IPs = 1
EndIf
IPAddress = ReplaceString(IPAddress, "|", #CR$ + #LF$)
ExamineDesktops()
If OpenWindow(#Window_0, DesktopWidth(0) - 234, 0, 234, 64 + 20 * IPs, "", #PB_Window_BorderLess | #PB_Window_Invisible )
If CreateGadgetList(WindowID(#Window_0))
ContainerGadget(#Container_0, 2, 2, 230, 60 + 20 * IPs, #PB_Container_Flat)
TextGadget(#Text_0, 10, 8, 50, 20, "User:")
SetGadgetFont(#Text_0, FontID1)
TextGadget(#Text_1, 10, 28, 50, 20, "Host:")
SetGadgetFont(#Text_1, FontID1)
TextGadget(#Text_2, 10, 48, 70, 20, "IP:")
SetGadgetFont(#Text_2, FontID1)
TextGadget(#Text_3, 60, 8, 160, 20, GetUserName())
SetGadgetFont(#Text_3, FontID1)
TextGadget(#Text_4, 60, 28, 160, 20, LCase(Hostname()))
SetGadgetFont(#Text_4, FontID1)
TextGadget(#Text_5, 60, 48, 160, 20 * IPs, IPAddress)
SetGadgetFont(#Text_5, FontID1)
CloseGadgetList()
EndIf
EndIf
EndProcedure
Define IPAddress.s
Define Event.l
InitNetwork()
IPAddress = GetIPAddress()
OpenWindow0(IPAddress)
;SetWindowPos_(WindowID(0), #HWND_TOPMOST, 0, 0, 0, 0,#SWP_NOMOVE | #SWP_NOSIZE)
SetWindowLong_(WindowID(#Window_0), #GWL_EXSTYLE, #WS_EX_TOOLWINDOW)
HideWindow(#Window_0, 0)
;SetWindowLong_(WindowID(#Window_0), #GWL_EXSTYLE, $00080000 | #WS_EX_PALETTEWINDOW | #WS_EX_TRANSPARENT)
;SetWindowLong_(WindowID(#Window_0), #GWL_EXSTYLE, $00080000 | #WS_EX_TOOLWINDOW | #WS_EX_PALETTEWINDOW | #WS_EX_TRANSPARENT)
;SetLayeredWindowAttributes_(WindowID(#Window_0), 0, 200, 2)
Repeat
Event = WaitWindowEvent()
Until Event = #PB_Event_CloseWindow