Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Color Picker TSR
#1
Code: (Select All)
Dim WinMse As POINTAPI
Type POINTAPI: As Long X_Pos, Y_Pos: End Type

Declare Dynamic Library "User32"
Function GetWindowLongA& (ByVal hwnd As Long, ByVal nIndex As Long)
Function SetWindowLongA& (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long)
Function GetAsyncKeyState% (ByVal vkey As Long)
Function GetCursorPos (lpPoint As POINTAPI)
End Declare
Width 12, 1 'large enough to hold our color value in hex
GWL_STYLE = -16
ws_border = &H800000
WS_VISIBLE = &H10000000
_Title "Color Picker"
hwnd& = _WindowHandle
winstyle& = GetWindowLongA&(hwnd&, GWL_STYLE)
_Delay .2
a& = SetWindowLongA&(hwnd&, GWL_STYLE, winstyle& And WS_VISIBLE)

Color 15
show = -1

swaptimer# = Timer(0.001) + 1

Do
If Timer(0.001) > swaptimer# Then
If GetAsyncKeyState(&H11) _Andalso GetAsyncKeyState(&H12) _Andalso GetAsyncKeyState(&H4B) Then
show = Not show
swaptimer# = (Timer(0.001) + 1) Mod 86400
If show Then _ScreenShow Else _ScreenHide
End If
End If
_Limit 30
z = GetCursorPos(WinMse)
_ScreenMove WinMse.X_Pos + 1, WinMse.Y_Pos + 1
tempimage = _ScreenImage
Cls , 0
_Source tempimage: Print Hex$(Point(WinMse.X_Pos, WinMse.Y_Pos));: _Source 0
_FreeImage tempimage
_Display
Loop

I don't know if TSR is the proper term for this type of program nowadays, but back in the yesteryears of the past these type of tools were called Terminate and Stay Resident programs.

Not that without a title bar and without any easy exit commands, this little program doesn't terminate and quit very easily on you now. You'll probably need to go into task manager to manually stop it, so keep that in mind. If you're not comfortable with manual program stopping then... why the heck are you into programming? Tongue

This works just like before except I've made some important changes here.

1)To start with, this loads and runs and behaves exactly as the other version...
2)..until you hit CTRL-ALT-K (for Kolor Picker), where it will then hide itself and disappear completely off your computer...
3)..until you hit CTRL-ALT-K once again, where the tool will instantly reappear at command and be usable once more.

Configure this to run in your windows startup and from now on, you'll always have a handle little CTRL-ALT-K color picker available for use on your machine!



So why is this here instead of in the other topic?

Basically so folks will take the time to read the fact that this doesn't ever terminate on its own. Start it up and it'll stay in your task list and do its thing forever more unless you manually close it yourself.

For me, this is a system tool which I can make use of to always be able to grab the color code from whatever I see on my monitor. My personal plan is just to pop this into windows startup and then it'll just always be an extended system tool for me. I thought others might like the same (or at least to see how to do the same so they could write similar little programs for themselves.)

For anyone who isn't familiar with how to make a program startup in windows, see the quick write up here: https://www.howtogeek.com/208224/how-to-...in-windows

Any questions, just ask. Wink
Reply


Messages In This Thread
Color Picker TSR - by SMcNeill - 01-24-2025, 08:55 AM
RE: Color Picker TSR - by SMcNeill - 01-24-2025, 10:37 AM
RE: Color Picker TSR - by Steffan-68 - 01-24-2025, 05:58 PM
RE: Color Picker TSR - by SMcNeill - 01-24-2025, 07:22 PM
RE: Color Picker TSR - by Pete - 01-24-2025, 06:00 PM
RE: Color Picker TSR - by Pete - 01-24-2025, 07:31 PM



Users browsing this thread: 6 Guest(s)