Print SCREEN is Driving me INSANE! HELP!
Ok, so my computer likes to randomelly use the print screen button. Like, whenever it feels like it will just randommely screen capture whatever Im doing. I tried everything from ripping the key off the keyboard (this laptop) to recovering with the system CDs. Its a huge problem because this laptop is slow, and a screen capture during something like a game will usually lag me for 5-10 seconds. and sometimes it does it in row like 15 times at once.
Anyways, I want to write a short program that I can load and will cause the computer to ignore the print-screen. I tried checking for a keyascii when the button is pressed, but there is none, so that idea is out. Im out of ideas...
Re: Print SCREEN is Driving me INSANE! HELP!
Sounds like a virus to me...
After the print screen, does anything transfer through internet ?
Re: Print SCREEN is Driving me INSANE! HELP!
Maybe there is a short in the wires for the print screen key? If it is on a laptop, you cant buy another keyboard :sick:
Re: Print SCREEN is Driving me INSANE! HELP!
Re: Print SCREEN is Driving me INSANE! HELP!
Quote:
Originally Posted by MartinLiss
:confused: that virus is 8 years old, and is sending stuff to the printer. But CVMichael is probably right anyway. But then I guess it is an other virus.
ØØ
Re: Print SCREEN is Driving me INSANE! HELP!
If you want to discard the Print Screen button you'll need a low-level keyboard hook. Copy the following code to a module.
VB Code:
Private Declare Function SetWindowsHookEx _
Lib "user32" Alias "SetWindowsHookExA" ( _
ByVal idHook As Long, _
ByVal lpfn As Long, _
ByVal hmod As Long, _
ByVal dwThreadId As Long) As Long
Private Declare Function CallNextHookEx Lib "user32" ( _
ByVal hHook As Long, _
ByVal nCode As Long, _
ByVal wParam As Long, _
ByVal lParam As Long) As Long
Private Declare Function UnhookWindowsHookEx Lib "user32" ( _
ByVal hHook As Long) As Long
Private Declare Sub CopyMemory _
Lib "kernel32" Alias "RtlMoveMemory" ( _
pDest As Any, _
pSource As Any, _
ByVal cb As Long)
Private Type KBDLLHOOKSTRUCT
vkCode As Long
scanCode As Long
flags As Long
time As Long
dwExtraInfo As Long
End Type
Private Const HC_ACTION = 0
Private Const VK_SNAPSHOT = &H2C
Private Const WH_KEYBOARD_LL = 13&
Private hKeyb As Long
Public Function KeybCallback(ByVal Code As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Static udtHook As KBDLLHOOKSTRUCT
If (Code = HC_ACTION) Then
'Copy the keyboard data out of the lParam (which is a pointer)
Call CopyMemory(udtHook, ByVal lParam, Len(udtHook))
If udtHook.vkCode = VK_SNAPSHOT Then
KeybCallback = 1
Exit Function
End If
End If
KeybCallback = CallNextHookEx(hKeyb, Code, wParam, lParam)
End Function
Public Sub HookKeyboard()
UnhookKeyboard
hKeyb = SetWindowsHookEx(WH_KEYBOARD_LL, AddressOf KeybCallback, App.hInstance, 0&)
End Sub
Public Sub UnhookKeyboard()
If hKeyb <> 0 Then
Call UnhookWindowsHookEx(hKeyb)
hKeyb = 0
End If
End Sub
In your Form_Load event call the HookKeyboard sub and in Form_Unload call UnhookKeyboard.
Re: Print SCREEN is Driving me INSANE! HELP!
Since the virus is that old, I'm sure that almost any antivirus program will remove it...
Also... if there was a keyboard problem, the keys around the "print screen" key should (but not neccesarily) be affected also.
So I'm still more inclined that it is a virus.
Re: Print SCREEN is Driving me INSANE! HELP!
That virus effected 16-bit DOS programs but it could of course still be a virus. It could also be a defect keyboard. On one of my older laptops I had a simular problem with the F10 key that constantly caused the menu of the current window to gain focus. Attaching an external keyboard caused the problem to disappear.
Re: Print SCREEN is Driving me INSANE! HELP!
Ohhh...that reminds me. If you have a wireeless keyboard. Try to change your batteries. And check that they have the right V. If you are using rechargable batteries, they are most often 1.2V, but normal AA batteries are 1.5V. That made my keyboard open up the help file and close Fx every now and then before I understood what it was.
ØØ
Re: Print SCREEN is Driving me INSANE! HELP!
Quote:
Originally Posted by NoteMe
:confused: that virus is 8 years old, and is sending stuff to the printer. But CVMichael is probably right anyway. But then I guess it is an other virus.
ØØ
Oops, didn't notice the date.
Re: Print SCREEN is Driving me INSANE! HELP!
Thank you for all the help guys!
it doesnt spool to the printer, and It does it even after a complete restore... I was thinking faulty keyboard but even with no key attached it still occurs... Perhaps I should try an external board. I am using the laptop's keyboard, not a wireless.
In any case, I will try that low-level hook above, but Im a bit confused... I know all I need to do is copy/paste and it should work... and thats GREAT! thank you for the help... BUT I hate just copy/pasting code without knowing what it does, I actually like to learn these things so I can use them in the future without having to bug people on a forum.
So I guess what im asking is, is there some kind of tutorial that teaches this stuff? I know there is lots of info on the guru website.
Re: Print SCREEN is Driving me INSANE! HELP!
The code creates a low-level keyboard hook, which means that the KeybCallback function above will be called first whenever a key is hit. The procedure only checks for the VK_SNAPSHOT key (which is the Print Screen key) and if it is the function returns TRUE (or 1) back to Windows which means that our application has handled the key and no more work should be done. This prevents Windows from taking the snapshot and copy it to the keyboard.
Re: Print SCREEN is Driving me INSANE! HELP!
I posted code that clears the clipboard twice a second 12 hours ago. Search for my posts. It may help you.
Re: Print SCREEN is Driving me INSANE! HELP!
Quote:
Originally Posted by dglienna
I posted code that clears the clipboard twice a second 12 hours ago. Search for my posts. It may help you.
I don't think it's the fact that the image is on the clipboard but rather that it takes time to put it there.
Re: Print SCREEN is Driving me INSANE! HELP!
Well guys it works great, thanks again, i found this article today: http://www.developer.com/net/vb/article.php/1502401
And it seems to be about what we are doing here, so I will read up on this technique. Thanks again for all the help! and the super-fast posting... Other forums (freshalloy.com, thirdgen.org) that I post on take Wayyyy longer to get help.
Re: Print SCREEN is Driving me INSANE! HELP!
Yeah, that article is using the same basic code as I posted earlier above.
Re: Print SCREEN is Driving me INSANE! HELP!
Quote:
Originally Posted by Joacim Andersson
If you want to discard the Print Screen button you'll need a low-level keyboard hook. Copy the following code to a module.
VB Code:
Private Declare Function SetWindowsHookEx _
Lib "user32" Alias "SetWindowsHookExA" ( _
ByVal idHook As Long, _
ByVal lpfn As Long, _
ByVal hmod As Long, _
ByVal dwThreadId As Long) As Long
Private Declare Function CallNextHookEx Lib "user32" ( _
ByVal hHook As Long, _
ByVal nCode As Long, _
ByVal wParam As Long, _
ByVal lParam As Long) As Long
Private Declare Function UnhookWindowsHookEx Lib "user32" ( _
ByVal hHook As Long) As Long
Private Declare Sub CopyMemory _
Lib "kernel32" Alias "RtlMoveMemory" ( _
pDest As Any, _
pSource As Any, _
ByVal cb As Long)
Private Type KBDLLHOOKSTRUCT
vkCode As Long
scanCode As Long
flags As Long
time As Long
dwExtraInfo As Long
End Type
Private Const HC_ACTION = 0
Private Const VK_SNAPSHOT = &H2C
Private Const WH_KEYBOARD_LL = 13&
Private hKeyb As Long
Public Function KeybCallback(ByVal Code As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Static udtHook As KBDLLHOOKSTRUCT
If (Code = HC_ACTION) Then
'Copy the keyboard data out of the lParam (which is a pointer)
Call CopyMemory(udtHook, ByVal lParam, Len(udtHook))
If udtHook.vkCode = VK_SNAPSHOT Then
KeybCallback = 1
Exit Function
End If
End If
KeybCallback = CallNextHookEx(hKeyb, Code, wParam, lParam)
End Function
Public Sub HookKeyboard()
UnhookKeyboard
hKeyb = SetWindowsHookEx(WH_KEYBOARD_LL, AddressOf KeybCallback, App.hInstance, 0&)
End Sub
Public Sub UnhookKeyboard()
If hKeyb <> 0 Then
Call UnhookWindowsHookEx(hKeyb)
hKeyb = 0
End If
End Sub
In your Form_Load event call the HookKeyboard sub and in Form_Unload call UnhookKeyboard.
-----------
Joacim, many thanks for your post. I'm pretty sure the problem you were responding to is caused by a h/w fault, not malware; I've reloaded XP & 2K on a similarly afflicted HP laptop, no help (the printscreens actually occur during the install- you can tell from the mouse image).
The printscreens kill any possibility of using Copy-Paste functions. I was researching a replacement for the PC when I stumbled across API solution you posted. If your ever in Leamington Spa, I'll buy you a pint or two. Thanks again.
Re: Print SCREEN is Driving me INSANE! HELP!
Hi, I'm having this exact same problem- my clipboard just fills up uncontrollably with screen prints rendering copy/paste unusable. A couple things I've noticed: it seems like the uncontrolled screen captures begin when I copy and paste one thing, and the "end" key temporarily stops the captures (sometimes it will start up again moments later though). Also, the problems started when I was doing a massive amount of copying/pasting (I was putting together a 200 page Word doc). I don't know crap about programming so I probably don't have vb on my laptop (wouldn't know even if I did). Can I still disable screencaptures somehow? Sorry to be thick. Thanks for any help!
Re: Print SCREEN is Driving me INSANE! HELP!
you may be able to disable the clipboard. Anyway, i would like to see the OP hook an external keyboard to his laptop and then disable through hardware settings the onboard keyboard. This will either confirm or not a hardware issue.