Read input when window is not active?
BlitzPlus Forums/BlitzPlus Programming/Read input when window is not active?
| ||
Is there any way to check for a hotkey combination while a blitz plus window is not active? I want to make a screen shot program that will take a shot of a specific area of the screen the user picks with the mouse. But I want the window to be minimized, or maybe in the system tray so the user won't have to deal with it. So it would have check for a key combination, then let the user drag a rectangle over what he wants to take a shot of all while minimized. I can probably fake the last part by snapshotting the whole desktop, blowing up a fullscreen window, drawing the desktop and letting the user pick on the fake screen. The hard part is how does a minimized application check for a hotkey or mouse button click (middle mouse for screen shot would be useful for taking a lot of snapshots)? I know windows programs can do this, I have another program called screenseize that does this but it's kind of flakey. I'd rather make my own to streamline my screen grabbing, which I do a lot of! |
| ||
I first tried Blitz+'s HotKeyEvent command, but it wouldn't work once the app was minimized. I came up with an userlib solution that will work, I just don't know about using a combination of keys with it. I'm pretty sure modifiers can be detected with this function, so search around and hopefully you can find a solution; Required Userlib ; .lib "user32.dll" ; GetAsyncKeyState%(vKey%) win = CreateWindow("Minimize me and hit F10", 100, 100, 250, 100, 0, 1 + 2) AutoSuspend 0 CreateTimer 60 Repeat Select WaitEvent() Case $803: Exit Case $4001 ; Uncomment to determine a hotkey code ;For i = 0 To 255 ; ret% = GetAsyncKeyState(i) ; If ret% Then RuntimeError "Hotkey code is " + Str(i) ;Next If GetAsyncKeyState(121) Then RuntimeError "Hotkey detected" ; F10 Hotkey Delay 5 End Select ForeverOh, and I almost forgot to mention this does not capture the key, other apps will still receive it after you're done with it. |
| ||
Eikon, is there any question I have that you can't answer? :) |
| ||
Probably. Just keep off the fun technical stuff and you'll be OK. I'll take that as a success, my stalking is done ;) |