da ich jetzt mein zweiten Thread eröffne will ich doch schonmal erwähnen das ich etwas besser PB kann bzw einiges gelernt habe seit ich mich vor 2 Monaten hier angemeldet und damit angefangen habe.

Naja, ehrlich bin ich ein paar Monate vor meiner Reise hierhin angefangen aber naja.

Zu meinem Problem:
Ich habe nun seit mehreren Tagen versucht (Etwa 5-8 Std am Tag ^^), wie man im OpenWindow Mode, Daten also
Code: Alles auswählen
SendNetworkData(ConnectionID, @String$, Len(String$))
Hier ist mein kompletter Code, vielleicht steigt einer von euch da durch.
Code: Alles auswählen
If InitKeyboard() = 0
MessageRequester("Error", "Error")
EndIf
If InitNetwork() = 0
MessageRequester("Error", "Error")
EndIf
; »»»»»»»»»» Enumeration
Procedure enu()
Enumeration
#Tolerance = 30
#ComNet_Client
#ComNet_In
#ComNet_Out
#ComNet_Send
#ComNet_Login
#ComNet_Info
#ComNet_UserIP
#ComNet_Username
#ComNet_Quit
EndEnumeration
EndProcedure
; »»»»»»»»»» Snapping
Procedure WindowCallback(hWnd.l,uMsg.l,wParam.l,lParam.l)
Select uMsg
Case #WM_WINDOWPOSCHANGING
*lpwp.WINDOWPOS = lParam
SystemParametersInfo_(#SPI_GETWORKAREA,0,rwa.RECT,0)
; OUTSIDE SCREEN
If *lpwp\x < 0
*lpwp\x - #Tolerance
EndIf
If (*lpwp\x + *lpwp\cx) > rwa\right
*lpwp\x + #Tolerance
EndIf
If *lpwp\y < 0
*lpwp\y - #Tolerance
EndIf
If (*lpwp\y + *lpwp\cy) > rwa\bottom
; *lpwp\y + #Tolerance
EndIf
; // INSIDE SCREEN
If *lpwp\x >= 0 And *lpwp\x <= (rwa\Left + #Tolerance)
*lpwp\x = rwa\Left
EndIf
If (*lpwp\x + *lpwp\cx) <= rwa\right And (*lpwp\x + *lpwp\cx) >= (rwa\right - #Tolerance)
*lpwp\x = rwa\right - *lpwp\cx
EndIf
If *lpwp\y >= 0 And *lpwp\y <= (rwa\Top + #Tolerance)
*lpwp\y = rwa\Top
EndIf
If (*lpwp\y + *lpwp\cy) <= rwa\Bottom And (*lpwp\y + *lpwp\cy) >= (rwa\Bottom - #Tolerance)
*lpwp\y = rwa\Bottom - *lpwp\cy
EndIf
EndSelect
ProcedureReturn #PB_ProcessPureBasicEvents
EndProcedure
; »»»»»»»»»» Fadeout
Procedure close_fadeout(win)
Protected x, y, w, h, t, winid
winid = WindowID(win)
x = WindowX(win)
y = WindowY(win)
w = WindowWidth(win)
h = WindowHeight(win)
t = 255
s = 255/15
SetWindowLong_(winid,#GWL_EXSTYLE,GetWindowLong_(winid,#GWL_EXSTYLE)|#WS_EX_LAYERED)
LockWindowUpdate_(WindowID(win))
For i = 1 To 15
Delay(1)
ResizeWindow(win, x+w*0.01, y+h*0.01, w*0.99, h*0.99)
x+w*0.005
y+h*0.005
w*0.99
h*0.99
t - s
SetLayeredWindowAttributes_(winid,0,t,2)
Next
CloseWindow(win)
EndProcedure
; »»»»»»»»»» Client Window
Procedure client()
OpenWindow(#ComNet_Client,0,0,600,400,"ComNet Messenger",#PB_Window_SystemMenu|#PB_Window_MinimizeGadget|#PB_Window_ScreenCentered) And CreateGadgetList(WindowID(#ComNet_Client))
EditorGadget(#ComNet_In,10,10,580,260,#PB_Editor_ReadOnly)
ButtonGadget(#ComNet_Login,380,280,100,20,"Server Login")
ButtonGadget(#ComNet_Send,490,280,100,20,"Senden")
EditorGadget(#ComNet_Out,10,310,580,80)
SetWindowCallback(@WindowCallback())
SendMessage_(GadgetID(#ComNet_In),#EM_SHOWSCROLLBAR,#SB_VERT,#False)
SendMessage_(GadgetID(#ComNet_In),#EM_SHOWSCROLLBAR,#SB_HORZ,#False)
AddKeyboardShortcut(#ComNet_Client,#PB_Shortcut_Escape,#ComNet_Quit)
AddKeyboardShortcut(#ComNet_Client,#PB_Shortcut_Return,#ComNet_Out)
EndProcedure
ip$ = InputRequester("Server IP","Bitte Server IP eingeben!","")
ConnectionID = OpenNetworkConnection(ip$, 6654,#PB_Network_TCP)
client()
If ConnectionID
AddGadgetItem(#ComNet_In,-1,"» Erfolgreich zum server Verbunden!")
AddGadgetItem(#ComNet_In,-1,"")
Else
AddGadgetItem(#ComNet_In,-1,"» Verbindung zum Server fehlgeschlagen!")
AddGadgetItem(#ComNet_In,-1,"")
EndIf
If String$
String$ = GetGadgetText(#ComNet_Out)
SendNetworkData(ConnectionID, @String$, Len(String$))
EndIf
Repeat
Select EventGadget()
Case #ComNet_Quit
EventID = #PB_Event_CloseWindow
close_fadeout(#ComNet_Client)
EndSelect
Until WaitWindowEvent() = #PB_Event_CloseWindow
close_fadeout(#ComNet_Client)
End
Code: Alles auswählen
Procedure enu()
Enumeration
#Tolerance = 30
#ComNet_Server
#ComNet_In
#ComNet_Menu
#ComNet_CL
#ComNet_View_CL
#ComNet_Quit
EndEnumeration
EndProcedure
; »»»»»»»»»» Snapping
Procedure WindowCallback(hWnd.l,uMsg.l,wParam.l,lParam.l)
Select uMsg
Case #WM_WINDOWPOSCHANGING
*lpwp.WINDOWPOS = lParam
SystemParametersInfo_(#SPI_GETWORKAREA,0,rwa.RECT,0)
; OUTSIDE SCREEN
If *lpwp\x < 0
*lpwp\x - #Tolerance
EndIf
If (*lpwp\x + *lpwp\cx) > rwa\right
*lpwp\x + #Tolerance
EndIf
If *lpwp\y < 0
*lpwp\y - #Tolerance
EndIf
If (*lpwp\y + *lpwp\cy) > rwa\bottom
; *lpwp\y + #Tolerance
EndIf
; // INSIDE SCREEN
If *lpwp\x >= 0 And *lpwp\x <= (rwa\Left + #Tolerance)
*lpwp\x = rwa\Left
EndIf
If (*lpwp\x + *lpwp\cx) <= rwa\right And (*lpwp\x + *lpwp\cx) >= (rwa\right - #Tolerance)
*lpwp\x = rwa\right - *lpwp\cx
EndIf
If *lpwp\y >= 0 And *lpwp\y <= (rwa\Top + #Tolerance)
*lpwp\y = rwa\Top
EndIf
If (*lpwp\y + *lpwp\cy) <= rwa\Bottom And (*lpwp\y + *lpwp\cy) >= (rwa\Bottom - #Tolerance)
*lpwp\y = rwa\Bottom - *lpwp\cy
EndIf
EndSelect
ProcedureReturn #PB_ProcessPureBasicEvents
EndProcedure
; »»»»»»»»»» Fadeout
Procedure close_fadeout(win)
Protected x, y, w, h, t, winid
winid = WindowID(win)
x = WindowX(win)
y = WindowY(win)
w = WindowWidth(win)
h = WindowHeight(win)
t = 255
s = 255/15
SetWindowLong_(winid,#GWL_EXSTYLE,GetWindowLong_(winid,#GWL_EXSTYLE)|#WS_EX_LAYERED)
LockWindowUpdate_(WindowID(win))
For i = 1 To 15
Delay(1)
ResizeWindow(win, x+w*0.01, y+h*0.01, w*0.99, h*0.99)
x+w*0.005
y+h*0.005
w*0.99
h*0.99
t - s
SetLayeredWindowAttributes_(winid,0,t,2)
Next
CloseWindow(win)
EndProcedure
InitNetwork()
If ExamineIPAddresses()
IP.l = NextIPAddress()
NextIP = NextIPAddress()
EndIf
*buffer = AllocateMemory(100)
If CreateNetworkServer(0, 6654,#PB_Network_TCP)
OpenWindow(#ComNet_Server,0,0,400,600,"ComNet Server 0.0.1",#PB_Window_SystemMenu|#PB_Window_MinimizeGadget|#PB_Window_ScreenCentered) And CreateGadgetList(WindowID(#ComNet_Server))
SetWindowCallback(@WindowCallback())
AddKeyboardShortcut(#ComNet_Server,#PB_Shortcut_Escape,#ComNet_Quit)
EditorGadget(#ComNet_In,10,10,380,580,#PB_Editor_ReadOnly)
AddGadgetItem(#ComNet_In,-1,"» Server erfolgreich erstellt!")
AddGadgetItem(#ComNet_In,-1,"» Server unter folgender TCP/IP erreichbar: " + IPString(NextIP) + "")
AddGadgetItem(#ComNet_In,-1,"")
AddGadgetItem(#ComNet_In,-1,"")
Repeat
Select NetworkServerEvent()
Case 0
If WaitWindowEvent() = #PB_Event_CloseWindow
Quit = 1
close_fadeout(#ComNet_Server)
EndIf
Delay(5)
Case 1
AddGadgetItem(#ComNet_In,-1,"» Client hat sich eingeloggt!")
ClientID.l = EventClient()
Case 2
length.l = ReceiveNetworkData(ClientID, *buffer, 100)
String$ = PeekS(*buffer, 100)
AddGadgetItem(#ComNet_In,-1,"» Empfang:" + String$)
Case 4
AddGadgetItem(#ComNet_In,-1,"» Client hat die Verbindung beendet!")
ClientID.l = EventClient()
EndSelect
Until Quit = 1
EndIf
FreeMemory(*buffer)
End