Una duda

Iniciado por VirucKingX, 24 Diciembre 2006, 21:16 PM

0 Miembros y 1 Visitante están viendo este tema.

VirucKingX

Como puedo hacer que el form sigua al mouse  ;D

esu nu mas  ;D

Bye falta poco para  ::)


Bye

DrakoX

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:

'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


'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


DrakoX

listo!!!
lo acabo de hacer,
y quedaria de la siguiente manera:

'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


'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

VirucKingX

DrakoX eres un maestro  ;D

Muxas gracias


Bye


Bye

DrakoX

jeje,
gracias,
me alegra que te alla servido

salu2