elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: Sigue las noticias más importantes de seguridad informática en el Twitter! de elhacker.NET


  Mostrar Temas
Páginas: [1]
1  Programación / Programación Visual Basic / Mover raton y pinchar dentro de otra aplicación en: 21 Septiembre 2011, 17:06 pm
Hola a todos, mi problema es el siguiente, he creado un programa para que cuando pulse una tecla determinada, mueva el raton y pulse en una zona determinada de otra aplicación, el problema es que no me funciona en el videojuego que quiero, y sin embargo, me funciona en otros juegos, aplicaciones de windows etc, vamos, en todos los sitios, menos en ese juego.

Este es el programa:


Código formulario:
Código
  1. Option Explicit
  2.  
  3. Const MOUSEEVENTF_ABSOLUTE = &H8000
  4. Const MOUSEEVENTF_LEFTDOWN = &H2
  5. Const MOUSEEVENTF_LEFTUP = &H4
  6. Const MOUSEEVENTF_MIDDLEDOWN = &H20
  7. Const MOUSEEVENTF_MIDDLEUP = &H40
  8. Const MOUSEEVENTF_MOVE = &H1
  9. Const MOUSEEVENTF_RIGHTDOWN = &H8
  10. Const MOUSEEVENTF_RIGHTUP = &H10
  11. Const MOUSEEVENTF_WHEEL = &H80
  12. Const MOUSEEVENTF_XDOWN = &H100
  13. Const MOUSEEVENTF_XUP = &H200
  14. Const WHEEL_DELTA = 120
  15. Const XBUTTON1 = &H1
  16. Const XBUTTON2 = &H2
  17.  
  18. Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer
  19.  
  20. Const SWP_NOMOVE = 2
  21. Const SWP_NOSIZE = 1
  22. Const HWND_TOPMOST = -1
  23. Const HWND_NOTOPMOST = -2 '
  24.  
  25. Private Declare Function SetWindowPos _
  26. Lib "user32" ( _
  27. ByVal hWnd As Long, _
  28. ByVal hWndInsertAfter As Long, _
  29. ByVal x As Long, ByVal y As Long, _
  30. ByVal cX As Long, _
  31. ByVal cY As Long, _
  32. ByVal wFlags As Long) As Long
  33.  
  34. Private Sub Form_Load()
  35. Form1.Move 24200, 6000
  36. SetWindowPos Me.hWnd, HWND_TOPMOST, 0, 0, 0, 0, _
  37. SWP_NOMOVE Or SWP_NOSIZE
  38. Timer1.Enabled = True
  39. End Sub
  40.  
  41. Private Sub Timer1_Timer()
  42. If GetAsyncKeyState(vbKeyNumpad0) Then
  43. SetCursorPos "388", "258"
  44. mouse_event MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0
  45. mouse_event MOUSEEVENTF_LEFTUP, 0, 0, 0, 0
  46. End If
  47. End Sub
  48.  

Código Módulo:
Código
  1. Public Declare Function SetCursorPos Lib "user32.dll" (ByVal x As Long, ByVal y As Long) As Long
  2.  
  3. Public Declare Sub mouse_event Lib "user32.dll" (ByVal dwFlags As Long, ByVal dx As Long, ByVal dy _
  4. As Long, ByVal cButtons As Long, ByVal dwExtraInfo As Long)
  5.  

¿Hay alguna manera de averiguar las propiedades de ese juego, mediante alguna API que llame al .exe, jugando con el hwnd o algo asi, para poder forzar el raton y que me deje moverlo?, es que la interfaz gráfica del juego es muy potente y no hay forma.

Si no es mucho pedir, necesitaria hacer las 2 cosas, pués sólo 1 de ellas no me serviria.

Espero que me podais ayudar.

Un saludo
Páginas: [1]
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines