Foro de elhacker.net

Programación => Programación Visual Basic => Mensaje iniciado por: VirucKingX en 24 Diciembre 2006, 21:16 pm



Título: Una duda
Publicado por: VirucKingX en 24 Diciembre 2006, 21:16 pm
Como puedo hacer que el form sigua al mouse  ;D

esu nu mas  ;D

Bye falta poco para  ::)


Título: Re: Una duda
Publicado por: DrakoX en 24 Diciembre 2006, 22:15 pm
Bueno,
aun no logro mantener el tamaño de la ventana,
pero si logre que el esta, siguiera al mouse por toda la pantalla,
en cuanto logre mantener en tamaño,
posteo nuevamente el code,

hasta ahora tengo esto:

Código:
'En el Form
Private Type POINTAPI
    x As Long
    y As Long
End Type

Private Declare Function WindowFromPoint Lib "user32" (ByVal xPoint As Long, ByVal yPoint As Long) As Long
Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
Dim Pt As POINTAPI, mWnd As Long

Private Sub Timer1_Timer()
GetCursorPos Pt
SetWindowPos Me.hwnd, HWND_TOPMOST, Pt.x, Pt.y, Me.Width, Me.Height, SWP_NOSIZE
End Sub

Código:
'En el modulo
Const SWP_NOSIZE = &H1
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

salu2 y suerte,
en cuanto pueda veo como solucionar esto

salu2



Título: Re: Una duda
Publicado por: DrakoX en 24 Diciembre 2006, 22:30 pm
listo!!!
lo acabo de hacer,
y quedaria de la siguiente manera:

Código:
'En un Modulo
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

Código:
'En el Form
Private Type POINTAPI
    x As Long
    y As Long
End Type
Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
Dim Pt As POINTAPI, mWnd As Long, CX As Long, CY As Long

Private Sub Timer1_Timer()
GetCursorPos Pt
CX = Me.Width / 15
CY = Me.Height / 15
SetWindowPos Me.hwnd, HWND_TOPMOST, Pt.x, Pt.y, CX, CY, SWP_NOSIZE
End Sub

ahora si, el form queda con su tamaño original,
deberias agregar un timer y ponerle un interbalo de 10 milisegundos,
no muhco mayor

salu2 y suerte


Título: Re: Una duda
Publicado por: VirucKingX en 25 Diciembre 2006, 01:30 am
DrakoX eres un maestro  ;D

Muxas gracias


Bye


Título: Re: Una duda
Publicado por: DrakoX en 25 Diciembre 2006, 11:48 am
jeje,
gracias,
me alegra que te alla servido

salu2