wr194t
10-20-2007, 02:32 PM
Ok first add this into your module or make another module and add this:
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
Const HWND_TOPMOST = -1
Const SWP_NOMOVE = &H2
Const SWP_NOSIZE = &H1
Public Function PutWindowOnTop (pFrm as Form)
Dim lngWindowPosition As Long
LngWindowPosition = SetWindowPos(pFrm.hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE Or SWP_NOSIZE)
End Function
Now make a new form, go to properties, BackColor, Palette and pick the color you want (The color you choose will be the color of your crosshair.):
http://img518.imageshack.us/img518/7383/68924052pp4.png
Still in properties find BoderStyle and change it to 0 - None:
http://img521.imageshack.us/img521/1889/71812322eg8.png
Now find StartUpPosition and change it to 2 - CenterScreen:
http://img518.imageshack.us/img518/552/91092162ca3.png
Now with the background of your form make it into a dot by making it smaller:
http://img136.imageshack.us/img136/4701/75033596lt2.png
After doing all that go to your 1st/main form.
If you want buttons:
Make two buttons for On and Off.
Code for the On Button:
Call PutWindowOnTop(Form2)
Form2.Show
Code for the Off button:
Call PutWindowOnTop(Form2)
Form2.Hide
If you want hotkeys then make two timers.
The first timer:
If GetKeyPress(vbKeyControl) And GetKeyPress(vbKeyC) Then
Call PutWindowOnTop(Form2)
Form2.Show
The second timer:
If GetKeyPress(vbKeyControl) And GetKeyPress(vbKeyV) Then
Call PutWindowOnTop(Form2)
Form2.Hide
You don't have to use Ctrl + V, C, you can use any hotkey(s) you desire.
Edit: I decided to add screenshots incase anyone has trouble with this tutorial.
Credits: wr194t.
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
Const HWND_TOPMOST = -1
Const SWP_NOMOVE = &H2
Const SWP_NOSIZE = &H1
Public Function PutWindowOnTop (pFrm as Form)
Dim lngWindowPosition As Long
LngWindowPosition = SetWindowPos(pFrm.hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE Or SWP_NOSIZE)
End Function
Now make a new form, go to properties, BackColor, Palette and pick the color you want (The color you choose will be the color of your crosshair.):
http://img518.imageshack.us/img518/7383/68924052pp4.png
Still in properties find BoderStyle and change it to 0 - None:
http://img521.imageshack.us/img521/1889/71812322eg8.png
Now find StartUpPosition and change it to 2 - CenterScreen:
http://img518.imageshack.us/img518/552/91092162ca3.png
Now with the background of your form make it into a dot by making it smaller:
http://img136.imageshack.us/img136/4701/75033596lt2.png
After doing all that go to your 1st/main form.
If you want buttons:
Make two buttons for On and Off.
Code for the On Button:
Call PutWindowOnTop(Form2)
Form2.Show
Code for the Off button:
Call PutWindowOnTop(Form2)
Form2.Hide
If you want hotkeys then make two timers.
The first timer:
If GetKeyPress(vbKeyControl) And GetKeyPress(vbKeyC) Then
Call PutWindowOnTop(Form2)
Form2.Show
The second timer:
If GetKeyPress(vbKeyControl) And GetKeyPress(vbKeyV) Then
Call PutWindowOnTop(Form2)
Form2.Hide
You don't have to use Ctrl + V, C, you can use any hotkey(s) you desire.
Edit: I decided to add screenshots incase anyone has trouble with this tutorial.
Credits: wr194t.