RAJA TEKNISI

Laki-laki, 21 tahun

Email : Jaj_Mv@yahoo.com

Phone : 085293578780

Demak, Indonesia

kita hidup d dunia ne hanya sbuah crita. dan crita psti da btas akhir'na. Jd mulai ckrng buatlah crita hidupmu sbaik mungkin, dan.... BelAjArlaH SEkaRaNg DaRi PAdA BEsOk, PeRlu di InGAT! KUnCi SuKseS ADAlaH JA=X+Y+Z
::
RAJA TEKNISI
www.RAJATEKNISI.com
Email : Jaj_mv@yahoo.com

Navbar3

Cari Blog Ini

Senin, 09 April 2012

Form Mengikuti Mouse Visual Basic

Berikut Langkah-Langkahnya :

[ VB 6.0 ]
Buat Form baru (BorderStyle=None) dengan sebuah Timer (Enabled=True; Interval=10).
Di bagian '(Declarations)' dari Form ketikkan :
Private 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 GetCursorPos Lib "user32.dll" (ByRef lpPoint As POINTAPI) As Long
Private Type POINTAPI
X As Long
Y As Long
End Type
Di bagian 'Form_Load' ketikkan :
SetWindowPos Me.hwnd, -1, 0, 0, 0, 0, &H1 Or &H2 'selalu di depan
Di bagian 'Timer1_Timer' ketikkan :
Dim p As POINTAPI
GetCursorPos p
Me.Left = (p.X * Screen.TwipsPerPixelX) + 100
Me.Top = (p.Y * Screen.TwipsPerPixelY) + 100



[ VB .NET ]
Buat Form baru (FormBorderStyle=None; TopMost=True) dengan sebuah Timer (Enabled=True; Interval=10).
Di bagian '(Declarations)' dari Form ketikkan :
Private Declare Function GetCursorPos Lib "user32.dll" (ByRef lpPoint As POINTAPI) As Integer
Private Structure POINTAPI
Dim X As Integer
Dim Y As Integer
End Structure
Di bagian 'Timer1_Tick' ketikkan :
Dim p As POINTAPI
GetCursorPos(p)
Me.Left = p.X + 5
Me.Top = p.Y + 5

0 komentar: