bin en faite j'utilise une vieille version de pure basic (la 4.20) et je suis sous vista donc c peut-être a cause de sa ...
Ha oui sa te dit sa par ce que tu n'as pas la partie serveur du programme ^^ je vais le mettre ici ( elle est pas complètement fini mais sa suffi a faire fonctionner le programme...
Code : Tout sélectionner
;code en pure basic 4.20
;
Enumeration
#fenetr_serveur
#Frame3D_pc1
#Frame3D_pc2
#Frame3D_pc3
#Frame3D_pc4
#Frame3D_pc5
#Frame3D_pc6
#Frame3D_pc7
#Frame3D_pc8
#Frame3D_pc9
#Frame3D_pc10
#pc1_15
#pc1_30
#pc1_60
#pc1_free
#temps_pc1
#pc2_15
#pc3_15
#pc4_15
#pc5_15
#pc2_30
#pc2_60
#pc2_free
#pc3_30
#pc3_60
#pc3_free
#pc4_30
#pc4_60
#pc4_free
#pc5_30
#pc5_60
#pc5_free
#temps_pc2
#temps_pc3
#temps_pc4
#temps_pc5
#pc6_15
#pc7_15
#pc8_15
#pc9_15
#pc10_15
#pc6_30
#pc6_60
#pc6_free
#pc7_30
#pc7_60
#pc7_free
#pc8_30
#pc8_60
#pc8_free
#pc9_30
#pc9_60
#pc9_free
#pc10_30
#pc10_60
#pc10_free
#temps_pc6
#temps_pc7
#temps_pc8
#temps_pc9
#temps_pc10
EndEnumeration
Procedure Open_fenetr_serveur()
If OpenWindow(#fenetr_serveur, 290, 20, 530, 325, "Pc Controler Admin", #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_SizeGadget | #PB_Window_TitleBar )
If CreateGadgetList(WindowID(#fenetr_serveur))
Frame3DGadget(#Frame3D_pc1, 5, 5, 100, 150, "PC : 1")
Frame3DGadget(#Frame3D_pc2, 110, 5, 100, 150, "PC : 2")
Frame3DGadget(#Frame3D_pc3, 215, 5, 100, 150, "PC : 3")
Frame3DGadget(#Frame3D_pc4, 320, 5, 100, 150, "PC : 4")
Frame3DGadget(#Frame3D_pc5, 425, 5, 100, 150, "PC : 5")
Frame3DGadget(#Frame3D_pc6, 5, 170, 100, 150, "PC : 6")
Frame3DGadget(#Frame3D_pc7, 110, 170, 100, 150, "PC : 7")
Frame3DGadget(#Frame3D_pc8, 215, 170, 100, 150, "PC : 8")
Frame3DGadget(#Frame3D_pc9, 320, 170, 100, 150, "PC : 9")
Frame3DGadget(#Frame3D_pc10, 425, 170, 100, 150, "PC : 10")
ButtonGadget(#pc1_15, 10, 20, 90, 25, "15 minutes")
ButtonGadget(#pc1_30, 10, 45, 90, 25, "30 minutes")
ButtonGadget(#pc1_60, 10, 70, 90, 25, "60 minutes")
ButtonGadget(#pc1_free, 10, 95, 90, 25, "Free", #PB_Button_Default | #PB_Button_Toggle)
StringGadget(#temps_pc1, 10, 125, 90, 25, "", #PB_String_ReadOnly)
ButtonGadget(#pc2_15, 115, 20, 90, 25, "15 minutes")
ButtonGadget(#pc3_15, 220, 20, 90, 25, "15 minutes")
ButtonGadget(#pc4_15, 325, 20, 90, 25, "15 minutes")
ButtonGadget(#pc5_15, 430, 20, 90, 25, "15 minutes")
ButtonGadget(#pc2_30, 115, 45, 90, 25, "30 minutes")
ButtonGadget(#pc2_60, 115, 70, 90, 25, "60 minutes")
ButtonGadget(#pc2_free, 115, 95, 90, 25, "Free", #PB_Button_Default | #PB_Button_Toggle)
ButtonGadget(#pc3_30, 220, 45, 90, 25, "30 minutes")
ButtonGadget(#pc3_60, 220, 70, 90, 25, "60 minutes")
ButtonGadget(#pc3_free, 220, 95, 90, 25, "Free", #PB_Button_Default | #PB_Button_Toggle)
ButtonGadget(#pc4_30, 325, 45, 90, 25, "30 minutes")
ButtonGadget(#pc4_60, 325, 70, 90, 25, "60 minutes")
ButtonGadget(#pc4_free, 325, 95, 90, 25, "Free", #PB_Button_Default | #PB_Button_Toggle)
ButtonGadget(#pc5_30, 430, 45, 90, 25, "30 minutes")
ButtonGadget(#pc5_60, 430, 70, 90, 25, "60 minutes")
ButtonGadget(#pc5_free, 430, 95, 90, 25, "Free", #PB_Button_Default | #PB_Button_Toggle)
StringGadget(#temps_pc2, 115, 125, 90, 25, "", #PB_String_ReadOnly)
StringGadget(#temps_pc3, 220, 125, 90, 25, "", #PB_String_ReadOnly)
StringGadget(#temps_pc4, 325, 125, 90, 25, "", #PB_String_ReadOnly)
StringGadget(#temps_pc5, 430, 125, 90, 25, "", #PB_String_ReadOnly)
ButtonGadget(#pc6_15, 10, 185, 90, 25, "15 minutes")
ButtonGadget(#pc7_15, 115, 185, 90, 25, "15 minutes")
ButtonGadget(#pc8_15, 220, 185, 90, 25, "15 minutes")
ButtonGadget(#pc9_15, 325, 185, 90, 25, "15 minutes")
ButtonGadget(#pc10_15, 430, 185, 90, 25, "15 minutes")
ButtonGadget(#pc6_30, 10, 210, 90, 25, "30 minutes")
ButtonGadget(#pc6_60, 10, 235, 90, 25, "60 minutes")
ButtonGadget(#pc6_free, 10, 260, 90, 25, "Free", #PB_Button_Default | #PB_Button_Toggle)
ButtonGadget(#pc7_30, 115, 210, 90, 25, "30 minutes")
ButtonGadget(#pc7_60, 115, 235, 90, 25, "60 minutes")
ButtonGadget(#pc7_free, 115, 260, 90, 25, "Free", #PB_Button_Default | #PB_Button_Toggle)
ButtonGadget(#pc8_30, 220, 210, 90, 25, "30 minutes")
ButtonGadget(#pc8_60, 220, 235, 90, 25, "60 minutes")
ButtonGadget(#pc8_free, 220, 260, 90, 25, "Free", #PB_Button_Default | #PB_Button_Toggle)
ButtonGadget(#pc9_30, 325, 210, 90, 25, "30 minutes")
ButtonGadget(#pc9_60, 325, 235, 90, 25, "60 minutes")
ButtonGadget(#pc9_free, 325, 260, 90, 25, "Free", #PB_Button_Default | #PB_Button_Toggle)
ButtonGadget(#pc10_30, 430, 210, 90, 25, "30 minutes")
ButtonGadget(#pc10_60, 430, 235, 90, 25, "60 minutes")
ButtonGadget(#pc10_free, 430, 260, 90, 25, "Free", #PB_Button_Default | #PB_Button_Toggle)
StringGadget(#temps_pc6, 10, 290, 90, 25, "", #PB_String_ReadOnly)
StringGadget(#temps_pc7, 115, 290, 90, 25, "", #PB_String_ReadOnly)
StringGadget(#temps_pc8, 220, 290, 90, 25, "", #PB_String_ReadOnly)
StringGadget(#temps_pc9, 325, 290, 90, 25, "", #PB_String_ReadOnly)
StringGadget(#temps_pc10, 430, 290, 90, 25, "", #PB_String_ReadOnly)
EndIf
EndIf
EndProcedure
Open_fenetr_serveur()
If InitNetwork() = 0
MessageRequester("Ereur", "Imposible de créer le sevrveur", 0)
End
EndIf
Port = 6832
CreateNetworkServer(0, Port)
If CreateNetworkServer(0, Port) = 0
MessageRequester("Serveur", "Ereur", 0)
End
EndIf
MessageRequester("Serveur", "Serveur initialisé (Port "+Str(Port)+").", 0)
Repeat
EventWindow = WaitWindowEvent()
Event = #PB_Event_Gadget
SEvent = NetworkServerEvent()
;{ clients
Select SEvent
Case #PB_NetworkEvent_Connect
If client_1 = 0
client_1 = EventClient()
ElseIf client_2 = 0
client_2 = EventClient()
ElseIf client_3 = 0
client_3 = EventClient()
ElseIf client_4 = 0
client_4 = EventClient()
ElseIf client_5 = 0
client_5 = EventClient()
ElseIf client_6 = 0
client_6 = EventClient()
ElseIf client_7 = 0
client_7 = EventClient()
ElseIf client_8 = 0
client_8 = EventClient()
ElseIf client_9 = 0
client_9 = EventClient()
ElseIf client_10 = 0
client_10 = EventClient()
EndIf
EndSelect
;}
;{ temps
If EventWindow = Event
Select EventGadget()
;pc1
Case #pc1_15
If client_1 <> 0
SendNetworkString(client_1,Str(3)) ;j'ai mis "3" pour ne pas avoir a attendre 15 minute ^^
Else
MessageRequester("Serveur", "PC déconnecté", 0)
EndIf
Case #pc1_30
If client_1 <> 0
SendNetworkString(client_1,Str(30))
Else
MessageRequester("Serveur", "PC déconnecté", 0)
EndIf
Case #pc1_60
If client_1 <> 0
SendNetworkString(client_1,Str(60))
Else
MessageRequester("Serveur", "PC déconnecté", 0)
EndIf
;pc2
Case #pc2_15
If client_2 <> 0
SendNetworkString(client_2,Str(15))
Else
MessageRequester("Serveur", "PC déconnecté", 0)
EndIf
Case #pc2_30
If client_2 <> 0
SendNetworkString(client_2,Str(30))
Else
MessageRequester("Serveur", "PC déconnecté", 0)
EndIf
Case #pc2_60
If client_2 <> 0
SendNetworkString(client_2,Str(60))
Else
MessageRequester("Serveur", "PC déconnecté", 0)
EndIf
;pc3
Case #pc3_15
If client_3 <> 0
SendNetworkString(client_3,Str(15))
Else
MessageRequester("Serveur", "PC déconnecté", 0)
EndIf
Case #pc3_30
If client_3 <> 0
SendNetworkString(client_3,Str(30))
Else
MessageRequester("Serveur", "PC déconnecté", 0)
EndIf
Case #pc3_60
If client_3 <> 0
SendNetworkString(client_3,Str(60))
Else
MessageRequester("Serveur", "PC déconnecté", 0)
EndIf
;pc4
Case #pc4_15
If client_4 <> 0
SendNetworkString(client_4,Str(15))
Else
MessageRequester("Serveur", "PC déconnecté", 0)
EndIf
Case #pc4_30
If client_4 <> 0
SendNetworkString(client_4,Str(30))
Else
MessageRequester("Serveur", "PC déconnecté", 0)
EndIf
Case #pc4_60
If client_4 <> 0
SendNetworkString(client_4,Str(60))
Else
MessageRequester("Serveur", "PC déconnecté", 0)
EndIf
;pc5
Case #pc5_15
If client_5 <> 0
SendNetworkString(client_5,Str(15))
Else
MessageRequester("Serveur", "PC déconnecté", 0)
EndIf
Case #pc5_30
If client_5 <> 0
SendNetworkString(client_5,Str(30))
Else
MessageRequester("Serveur", "PC déconnecté", 0)
EndIf
Case #pc5_60
If client_5 <> 0
SendNetworkString(client_5,Str(60))
Else
MessageRequester("Serveur", "PC déconnecté", 0)
EndIf
;pc6
Case #pc6_15
If client_6 <> 0
SendNetworkString(client_6,Str(15))
Else
MessageRequester("Serveur", "PC déconnecté", 0)
EndIf
Case #pc6_30
If client_6 <> 0
SendNetworkString(client_6,Str(30))
Else
MessageRequester("Serveur", "PC déconnecté", 0)
EndIf
Case #pc6_60
If client_6 <> 0
SendNetworkString(client_6,Str(60))
Else
MessageRequester("Serveur", "PC déconnecté", 0)
EndIf
;pc7
Case #pc7_15
If client_7 <> 0
SendNetworkString(client_7,Str(15))
Else
MessageRequester("Serveur", "PC déconnecté", 0)
EndIf
Case #pc7_30
If client_7 <> 0
SendNetworkString(client_7,Str(30))
Else
MessageRequester("Serveur", "PC déconnecté", 0)
EndIf
Case #pc7_60
If client_7 <> 0
SendNetworkString(client_7,Str(60))
Else
MessageRequester("Serveur", "PC déconnecté", 0)
EndIf
;pc8
Case #pc8_15
If client_8 <> 0
SendNetworkString(client_8,Str(15))
Else
MessageRequester("Serveur", "PC déconnecté", 0)
EndIf
Case #pc8_30
If client_8 <> 0
SendNetworkString(client_8,Str(30))
Else
MessageRequester("Serveur", "PC déconnecté", 0)
EndIf
Case #pc8_60
If client_8 <> 0
SendNetworkString(client_8,Str(60))
Else
MessageRequester("Serveur", "PC déconnecté", 0)
EndIf
;pc9
Case #pc9_15
If client_9 <> 0
SendNetworkString(client_9,Str(15))
Else
MessageRequester("Serveur", "PC déconnecté", 0)
EndIf
Case #pc9_30
If client_9 <> 0
SendNetworkString(client_9,Str(30))
Else
MessageRequester("Serveur", "PC déconnecté", 0)
EndIf
Case #pc9_60
If client_9 <> 0
SendNetworkString(client_9,Str(60))
Else
MessageRequester("Serveur", "PC déconnecté", 0)
EndIf
;pc10
Case #pc10_15
If client_10 <> 0
SendNetworkString(client_10,Str(15))
Else
MessageRequester("Serveur", "PC déconnecté", 0)
EndIf
Case #pc10_30
If client_10 <> 0
SendNetworkString(client_10,Str(30))
Else
MessageRequester("Serveur", "PC déconnecté", 0)
EndIf
Case #pc10_60
If client_10 <> 0
SendNetworkString(client_10,Str(60))
Else
MessageRequester("Serveur", "PC déconnecté", 0)
EndIf
EndSelect
;}
EndIf
Until Eventwindow = #PB_Event_CloseWindow