Menú

Mostrar Mensajes

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ú

Mensajes - Progmasterbr

#11
Aquí

(http://tempsend.com/B7B870ADCA/4A2E/CLIENT_SERVER%20EXAMPLE.rar)

os dejo el enlace para descargar este ejemplo. Así que usted comprenderá mejor.
No virus, sólo el código fuente.
#12
Tengo un problema en relación con dos rectángulos (en servidor y cliente, respectivamente). El rectángulo rojo se dibuja en el lado del servidor, y el rectángulo con un agujero se crea en el lado del cliente. Pero el rectángulo con el agujero que se dibuja en el lado del cliente, nunca se queda en la misma posición que ya se definió en Server.

Todas las sugerencias son bienvenidas.

Por lo tanto, mi resultado hasta ahora esto es:



Del lado del servidor


Dim mRect As Rectangle
Dim d

'=========================== DRAW RECTANGLE IN PICTUREBOX ===================================

   Private Sub PictureBoxREMOTO_MouseDown(sender As Object, e As MouseEventArgs) Handles PictureBoxREMOTO.MouseDown
       mRect = New Rectangle(e.X - d.x, e.Y - d.y, 0, 0)
       PictureBoxREMOTO.Invalidate()
   End Sub

   Private Sub PictureBoxREMOTO_MouseMove(sender As Object, e As MouseEventArgs) Handles PictureBoxREMOTO.MouseMove

       If e.Button = Windows.Forms.MouseButtons.Left Then

           Dim gp As New System.Drawing.Drawing2D.GraphicsPath

           mRect = New Rectangle(mRect.Left, mRect.Top, e.X - d.x - mRect.Left, e.Y - d.y - mRect.Top)

           PictureBoxREMOTO.Invalidate()
       End If
   End Sub

   Private Sub PictureBoxREMOTO_Paint(sender As Object, e As PaintEventArgs) Handles PictureBoxREMOTO.Paint
       Dim mRect2 = New Rectangle(mRect.Location, mRect.Size)
       mRect2.Offset(d)

       Using pen As New Pen(Color.Red, 3)
           e.Graphics.DrawRectangle(pen, mRect2)
       End Using
   End Sub

   Private Sub PictureBoxREMOTO_MouseUp(sender As Object, e As MouseEventArgs) Handles PictureBoxREMOTO.MouseUp

       Dim MENSAJE As String = "HOLE:" & mRect.Left & ":" & mRect.Top & ":" & e.X - d.x - mRect.Left & ":" & e.Y - d.y - mRect.Top
       ENVIO = System.Text.Encoding.UTF7.GetBytes(MENSAJE)

       'mRect = New Rectangle(e.X - d.x, e.Y - d.y, 0, 0)
       'PictureBoxREMOTO.Invalidate()

   End Sub

   Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
       d = PictureBoxREMOTO.PointToClient(PictureBoxREMOTO.Location)
   End Sub

   '=========================================================================================




Lado del cliente


Private j As Integer
Private z As Integer
Private l As Integer
Private m As Integer

Private Sub DDMain()
       BeginInvoke(New Action(AddressOf Rise_DD))
   End Sub

   Private Sub Rise_DD()

           Form2.m = j
           Form2.n = z
           Form2.o = l
           Form2.p = m

           Form2.Button1_Click(Me, Nothing)

   End Sub


Public Sub ORDENES(ByVal ORDEN As String)

           Dim PARTES As String() = ORDEN.Split(":")
           POSICIONX = PARTES(1)
           POSICIONY = PARTES(2)
           Cursor.Position = New Point(POSICIONX, POSICIONY)

           Select Case PARTES(0)


               Case "HOLE"

                   'Coordinates of rectangle drawn on Server

                   j = PARTES(1)
                   z = PARTES(2)
                   l = PARTES(3)
                   m = PARTES(4)

                   DDMain()

                   'MessageBox.Show(PARTES(1) & " - " & PARTES(2) & " - " & PARTES(3) & " - " & PARTES(4)) 'Coordinates of rectangle drawed on Server

           End Select

   End Sub



Form2 del lado del cliente


Public m As Integer
Public n As Integer
Public o As Integer
Public p As Integer

   Public Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click

       Dim mRect As Rectangle

       Dim gp As New System.Drawing.Drawing2D.GraphicsPath

       gp.AddRectangle(New Rectangle(0, 0, Me.Width, Me.Height))

       mRect = New Rectangle(m, n, o, p)

       gp.AddRectangle(mRect)

       Me.Region = New Region(gp)

       Me.Invalidate()

   End Sub
#13
LeandroA,

las funciones anteriores no reconocen el nombre de mi programa para comprobar, por lo que cuando se está ejecutando, dicen que no es cierto (falso).

Usted puede tratar de ver el nombre de su programa hecho en VB.NET (mi caso) no está funcionando. Ahora con otro programa funciona bien (por ejemplo, "chrome.exe").

Es decir, las funciones anteriores fallan para verificar algunos nombres de proceso. :-(
#14
LeandroA,

El problema sigue apareciendo.
aquí está mi proyecto http://tempsend.com/370CC8ED77, y cómo me estoy tratando de verificar si un determinado programa se está ejecutando.
#15
Buen día amigos,

Tengo dos funciones que sirven para verificar si un proceso que ya está en marcha, pero return false cuando el proceso se está ejecutando.

¿Podría alguien ayudarme con esto, por favor?

Aquí dejo las funciones que estoy utilizando:




''''''''''''''''''''''''''''''''' PROCESS EXISTS '''''''''''''''''''''

Private Const MAX_PATH = 260
Private Const PROCESS_QUERY_INFORMATION = &H400

Private Declare Function OpenProcess Lib "kernel32" ( _
   ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, ByVal dwProcessID As Long) As Long

Private Declare Function EnumProcesses Lib "PSAPI.DLL" ( _
  lpidProcess As Long, ByVal cb As Long, cbNeeded As Long) As Long

Private Declare Function EnumProcessModules Lib "PSAPI.DLL" ( _
   ByVal hProcess As Long, lphModule As Long, ByVal cb As Long, lpcbNeeded As Long) As Long

Private Declare Function GetModuleBaseName Lib "PSAPI.DLL" Alias "GetModuleBaseNameA" ( _
   ByVal hProcess As Long, ByVal hModule As Long, ByVal lpFileName As String, ByVal nSize As Long) As Long

Private Const PROCESS_VM_READ = &H10
Private Const PROCESS_QUERY_INFORMATION = &H400

Private Type PROCESSENTRY32
   dwSize As Long
   cntUsage As Long
   th32ProcessID As Long
   th32DefaultHeapID As Long
   th32ModuleID As Long
   cntThreads As Long
   th32ParentProcessID As Long
   pcPriClassBase As Long
   dwFlags As Long
   szExeFile As String * MAX_PATH
End Type
Private Declare Function CreateToolhelpSnapshot Lib "kernel32" Alias "CreateToolhelp32Snapshot" (ByVal lFlags As Long, ByVal lProcessID As Long) As Long
   Private Const TH32CS_SNAPPROCESS As Long = 2&
   Private Declare Function GetWindowThreadProcessId Lib "user32" (ByVal hWnd As Long, lpdwProcessId As Long) As Long
Private Declare Function ProcessFirst Lib "kernel32" Alias "Process32First" (ByVal hSnapshot As Long, uProcess As PROCESSENTRY32) As Long
Private Declare Function ProcessNext Lib "kernel32" Alias "Process32Next" (ByVal hSnapshot As Long, uProcess As PROCESSENTRY32) As Long
Private Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long

''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''


Private Function FindProcessID(ByVal pExename As String) As Long

   Dim ProcessID As Long, hSnapshot As Long
   Dim uProcess As PROCESSENTRY32, rProcessFound As Long
   Dim Pos As Integer, szExename As String
   
   hSnapshot = CreateToolhelpSnapshot(TH32CS_SNAPPROCESS, 0&)
   
   If hSnapshot = -1 Then
       Exit Function
   End If
   
   uProcess.dwSize = Len(uProcess)
   
   rProcessFound = ProcessFirst(hSnapshot, uProcess)
   Do While rProcessFound
       Pos = InStr(1, uProcess.szExeFile, vbNullChar)
       If Pos Then
           szExename = Left$(uProcess.szExeFile, Pos - 1)
       End If
       If LCase$(szExename) = LCase$(pExename) Then
           
           ProcessID = uProcess.th32ProcessID
           Exit Do
         Else
           
           rProcessFound = ProcessNext(hSnapshot, uProcess)
       End If
   Loop
   CloseHandle hSnapshot
   FindProcessID = ProcessID

End Function

Private Function IsProcessRunning2(PID As Long) As Boolean
Dim hProcess As Long
hProcess = OpenProcess(PROCESS_QUERY_INFORMATION, 0, PID)
CloseHandle hProcess
IsProcessRunning2 = hProcess
End Function


Private Function IsProcessRunning(ByVal sProcess As String) As Boolean
   Const MAX_PATH As Long = 260
   Dim lProcesses() As Long, lModules() As Long, N As Long, lRet As Long, hProcess As Long
   Dim sName As String
   
   sProcess = UCase$(sProcess)
   
   ReDim lProcesses(1023) As Long
   If EnumProcesses(lProcesses(0), 1024 * 4, lRet) Then
       For N = 0 To (lRet \ 4) - 1
           hProcess = OpenProcess(PROCESS_QUERY_INFORMATION Or PROCESS_VM_READ, 0, lProcesses(N))
           If hProcess Then
               ReDim lModules(1023)
               If EnumProcessModules(hProcess, lModules(0), 1024 * 4, lRet) Then
                   sName = String$(MAX_PATH, vbNullChar)
                   GetModuleBaseName hProcess, lModules(0), sName, MAX_PATH
                   sName = Left$(sName, InStr(sName, vbNullChar) - 1)
                   If Len(sName) = Len(sProcess) Then
                       If sProcess = UCase$(sName) Then IsProcessRunning = True: Exit Function
                   End If
               End If
           End If
           CloseHandle hProcess
       Next N
   End If
End Function





Desde ya muchas gracias
#16
Gracias PKJ!, su primera función es todavía su detección por Antivurus, y la segunda función, acusó archivo sospechoso en Avast, pero los dos trabajan perfectamente!
#17
hola,

tengo una función del un Stub en un joiner (Función "split") que está siendo detectado por antivirus en la siguiente línea:

V50 = V40

Esta línea es una de las más importantes de esta función

Por favor, alguien me podría ayudar con alguna modificación para esta función?

Segue lo código de la Funcíon:



Private Function Separa(ByVal V1 As String, Optional ByVal V2 As String, Optional ByVal V3 As Long = -1) As String()

Dim V40 As Long, V50 As Long, V6 As Long, V7 As Long, V8 As Long, V9() As String

V6 = Len(V1)

If V2 = vbNullString Then V2 = " "
V7 = Len(V2)

If V3 = 0 Then GoTo QuitHere
If V6 = 0 Then GoTo QuitHere
If InStr(1, V1, V2, vbBinaryCompare) = 0 Then GoTo QuitHere

ReDim V9(0)
V40 = 1
V50 = 1

Do
If V8 + 1 = V3 Then
V9(V8) = Mid$(V1, V40)
Exit Do
End If

V50 = InStr(V50, V1, V2, vbBinaryCompare)

If V50 = 0 Then
If Not V40 = V6 Then
V9(V8) = Mid$(V1, V40)
End If
Exit Do
End If

V9(V8) = Mid$(V1, V40, V50 - V40)
V8 = V8 + 1

ReDim Preserve V9(V8)

V40 = V50 + V7
V50 = V40
Loop

ReDim Preserve V9(V8)
Separa = V9

Exit Function

QuitHere:
ReDim Separa(-1 To -1)

End Function

#18
¿Alguien todavía tiene ese proyecto realizado por EON? Tengo que estudiarlo porque estoy haciendo algo muy similar.

Si alguien tiene, aquí está mi contacto:

Skype: xmradio80

Gracias