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 - Dessa

#11


Option Explicit


Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long

Private Sub Command1_Click()

Dim hWndMain As Long
Dim hWndChild As Long
Dim hWndAnalizar As Long

hWndMain = FindWindow("PiriformCCleaner", "Piriform CCleaner")


If hWndMain = 0 Then
  MsgBox "Ccleaner sin Ejecutar"
Else
  hWndChild = FindWindowEx(hWndMain, 0, "#32770", vbNullString)
  hWndAnalizar = FindWindowEx(hWndChild, 0, "Button", "&Analizar")

  If hWndAnalizar = 0 Then
    MsgBox "La Opcion Limpiador no está Seleccionada"
  Else
    MsgBox hWndAnalizar
  End If
End If

End Sub




#13
Foro Libre / Re: Muere Hugo Chávez
6 Marzo 2013, 04:02 AM
Un Patriota latino-Américano, la lucha continúa !!!

#14
No hay que desenfocarse, lo pasado está pisado (en epocas de Pinochet y las juntas militares Argentinas) por lo menos para mí.

Desde mi punto de vista prefiero la región lo mas unida posible yá que los dinosaurios de aquella epoca están casi todos muertos y los pocos que aún víven espero que se "Vayan" lo antes posible (Y si se llevan al FMI con ellos... mejor todavía)


#15
Probá este codigo pasando el mouse sobre el picture externo para saber la coordena del control (no la de pantalla ) a la que queres enviar click   y luego mandale  el click a esa coordenada con  SendMessage y Make_lParam

La aplicación externa es tuya o es "ajena" ?


FORM



Option Explicit

Private Sub Form_Load()
Call SetWindowPos(Me.hwnd, &HFFFF, &H0, &H0, &H0, &H0, &H2 Or &H1) 'on top (opcional)
Call StartHook
End Sub
Private Sub Form_Unload(Cancel As Integer)
 StopHook
End Sub





MODULO





Option Explicit


Public Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long

Private Declare Function SetWindowsHookEx Lib "user32.dll" Alias "SetWindowsHookExA" (ByVal idHook As Long, ByVal lpfn As Long, ByVal hmod As Long, ByVal dwThreadId As Long) As Long
Private Declare Function UnhookWindowsHookEx Lib "user32.dll" (ByVal hHook As Long) As Long
Private Declare Function CallNextHookEx Lib "user32" (ByVal hHook As Long, ByVal ncode As Long, ByVal wParam As Long, lParam As Any) As Long

Private Declare Function WindowFromPoint Lib "user32" (ByVal xPoint As Long, ByVal yPoint As Long) As Long

Private Type POINTAPI: x As Long: y As Long: End Type

Private Declare Function ClientToScreen Lib "user32" (ByVal hwnd As Long, lpPoint As POINTAPI) As Long

Dim hHook As Long

Function Make_lParam(ByVal x As Integer, ByVal y As Integer) As Long
 Make_lParam = x Or (y * &H10000)
End Function

Public Sub StartHook()
    hHook = SetWindowsHookEx(&HE, AddressOf MouseProc, App.hInstance, &H0)
End Sub

Public Sub StopHook()
   Call UnhookWindowsHookEx(hHook)
   hHook = 0
End Sub

Private Function MouseProc(ByVal ncode As Long, ByVal wParam As Long, lParam As POINTAPI) As Long

 Dim hwndl As Long
 hwndl = WindowFromPoint(lParam.x, lParam.y)

 '.......................................................................
  Dim PT As POINTAPI
  Call ClientToScreen(hwndl, PT)

  Form1.Cls
  Form1.Print "Coordenada Screen X " & lParam.x
  Form1.Print "Coordenada Screen Y " & lParam.y

  Form1.Print
  Form1.Print "Coordenada Control X " & lParam.x - PT.x
  Form1.Print "Coordenada Control Y " & lParam.y - PT.y
   
  Form1.Print
  Form1.Print "hwndl del Control  " & hwndl
 '.......................................................................
 
  MouseProc = CallNextHookEx(hHook, ncode, wParam, lParam)

End Function






#16
Si desde tu aplicacion tenes que mandar un click a un picture de una aplicacion externa (supongo que es por eso que decis que no tenes el evento Picture1_MouseUp) simplemente capturas el Hwnd del picture externo y le mandas los mensajes

Call SendMessage(hwnd_del_picture_externo, WM_LBUTTONDOWN, 0, 0&)
Call SendMessage(hwnd_del_picture_externo, WM_LBUTTONUP, 0, 0&)

los mensajes llegarán a la coordenada 1,1 (x-y) del control

si queres mandar el click a una coordenada espesífica tenes que usar Make_lParam

http://foro.elhacker.net/programacion_visual_basic/clickear_sin_mover_mouse-t334718.0.html;msg1652116#msg1652116

PD:  ByVal lParam de SendMessage as Long


#17
No sé si endndí bien tu pregunta, tr referías a esto ?




Option Explicit

Private Const WM_LBUTTONDOWN = &H201
Private Const WM_LBUTTONUP = &H202
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long


Private Sub Form_Load()
Caption = 0
Timer1.Interval = 15
End Sub

Private Sub Picture1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
  If Button = vbLeftButton Then Caption = Caption + 1
End Sub

Private Sub Timer1_Timer()
  Call SendMessage(Picture1.hwnd, WM_LBUTTONDOWN, 0, 0&)
  Call SendMessage(Picture1.hwnd, WM_LBUTTONUP, 0, 0&)
End Sub




#18
Hola Cromático, si querés un solo Click (usando los mensajes WM_LBUTTONDOWN y WM_LBUTTONUP)  probá con los eventos MouseDown o MouseUp, saludos

#19
Cita de: Elemental Code en  6 Septiembre 2012, 23:50 PM

Tenia un conflicto en las clases.





Option Explicit

Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long

Dim window As Long

Private Sub Form_Load()

If App.LogMode = 0 Then
    window = FindWindow("ThunderFormDC", vbNullString) ' IDE
ElseIf App.LogMode = 1 Then
    window = FindWindow("ThunderRT6FormDC", vbNullString) ' EXE
End If
   
MsgBox window, , "LogMode " & App.LogMode

End Sub




#20
Declaraste mal

Private Const ILVM_GETITEMW = (LVM_FIRST + 75)



es:



Private Const LVM_GETITEMW = (LVM_FIRST + 75)



or



Private Const LVM_GETITEMW = &H104B