Hola
Programas y Sistemas
* Integrantes: Ana
* Curso: 5° “A” Informática
* Colegio: Casa Salesiana Pio Ix
* Grupo: G2
* Profesores: Pugliese, Oscar; Ottati, Leandro
* Fecha de entrega: 25/06/12
Chat
Private Sub cmdCliente_Click()
frmChat.Hide
G2_Cliente.Top = frmMenu.Top
G2_Cliente.Left = frmMenu.Left + frmMenu.WidthG2_Cliente.Show
End Sub
Private Sub cmdServidor_Click()
frmChat.Hide
G2_Servidor.Top = frmMenu.Top
G2_Servidor.Left = frmMenu.Left + frmMenu.Width
G2_Servidor.Show
End Sub
Menú
Option Explicit
Dim nombrePrograma(1) As String
Dim w As Integer
Private Sub cmdPrograma_Click(Index As Integer)
subCerrarForms
Select Case Index
Case Is = 0frmPacman.Top = Me.Top
frmPacman.Left = Me.Left + Me.Width
frmPacman.Show
Case Is = 1
frmChat.Top = Me.Top
frmChat.Left = Me.Left + Me.Width
frmChat.Show
End Select
End Sub
Private Sub Form_Load()
Me.Caption = "Menú"
nombrePrograma(0) = "Pacman"
nombrePrograma(1) = "Chat”cmdPrograma(0).Caption = nombrePrograma(0) 'El primer botón ya ha sido creado en la edición.
Load cmdPrograma(1)
cmdPrograma(1).Visible = True
cmdPrograma(1).Top = cmdPrograma(0).Top + cmdPrograma(1).Height + 100
cmdPrograma(1).Caption = nombrePrograma(1)
End Sub
Private Sub subCerrarForms()
Unload frmPacman
Unload frmChat
End Sub
Private Sub Form_Unload(Cancel AsInteger)
End 'Al cerrar con cruz el menú, cierra cualquier ventana que haya quedado abierta.
End Sub
Pacman
Option Explicit
Dim distanciaEje, distanciaChoque, w, errX, errY, posicionX, posicionY As Integer
Dim tiempoActual, tiempoComibles As Integer
Dim velPacman, direccionPacman, secuenciaPacman As Integer
Dim velFantasma(5), direccionFantasma(5), secuenciaFantasma(5) As Integer
Dimfin, viveFantasma(5) As Boolean
Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)
Dim Buffer, datos() As String 'variables para guardar los datos
Winsock1.GetData Buffer
If Str(Buffer) <> "" Then
datos = Split(Buffer, ",")
imgPacman.Picture = LoadPicture(App.Path + "\Misc\" + Trim(datos(0)) + ".jpg")
imgPacman.Top = datos(1)imgPacman.Left = datos(2)
imgPacman.ZOrder (0) 'Ubica los fantasmas adelante.
For w = 1 To 4
imgFruta(w).Visible = datos(3 + (w - 1) * 6)
imgFruta(w).Top = datos(4 + (w - 1) * 6)
imgFruta(w).Left = datos(5 + (w - 1) * 6)
imgFantasma(w).Top = datos(6 + (w - 1) * 6)
imgFantasma(w).Left = datos(7 + (w - 1) * 6)imgFantasma(w).Picture = LoadPicture(App.Path + "\Misc\" + Trim(Str(datos(8 + (w - 1) * 6))) + ".jpg")
imgFantasma(w).ZOrder (0) 'Ubica los fantasmas adelante.
Next
End If
End Sub
Private Sub Winsock1_ConnectionRequest(ByVal requestID As Long)
Winsock1.Close
Winsock1.Accept requestID
End Sub
Private Sub Winsock1_Connect()fraConexion.Visible = False
If optCliente.Value = True Then subIniciar
End Sub
Private Sub cmdConectar_Click()
If optCliente.Value = True Then
Winsock1.RemoteHost = txtServidor.Text
Winsock1.RemotePort = txtPuerto.Text
Winsock1.Close
Winsock1.Connect
Else
Winsock1.Close
Winsock1.LocalPort = txtPuerto.Text
Winsock1.Listen
EndIf
End Sub
Private Sub cmdDesconectar_Click()
Winsock1.Close
End Sub
Private Sub Form_Activate()
'fraConexion.Visible = False
'subIniciar
End Sub
Private Sub optCliente_Click()
cmdConectar.Caption = "Conectar"
txtServidor.Enabled = True
End Sub
Private Sub optServidor_Click()
cmdConectar.Caption = "Escuchar"
txtServidor.Enabled = False
End Sub...
Regístrate para leer el documento completo.