How do you find the keycode for the key Print Screen?
Author |
Message |
HazySmoke)345
![](http://i10.photobucket.com/albums/a121/HazySmoke/clubps2.jpg)
|
Posted: Tue Mar 07, 2006 4:33 pm Post subject: How do you find the keycode for the key Print Screen? |
|
|
Yes... I did tried to make a short program in order to find the keycode, it goes something like this:
VisualBASIC: | Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
Print "Keycode = " & KeyCode
End Sub |
It works with any keys on the keyboard besides Print Screen... Nothing happens when I press that particular key. I wonder why. Anyone know the number for that? |
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
[Gandalf]
![](http://compsci.ca/v3/uploads/user_avatars/189297994e4c716fec7f1.png)
|
Posted: Tue Mar 07, 2006 4:39 pm Post subject: (No subject) |
|
|
For simple things like this, and for something as... popular... as VB, you should use google.
Answer: vbKeyPrint (0x2A) |
|
|
|
|
![](images/spacer.gif) |
HazySmoke)345
![](http://i10.photobucket.com/albums/a121/HazySmoke/clubps2.jpg)
|
Posted: Wed Mar 08, 2006 6:02 pm Post subject: (No subject) |
|
|
Thanks for helping... that was kind of simple. Now here's the second part.
Now I want the computer to capture a screenshot. I entered this in the form:
VisualBASIC: | Private Declare Sub keybd_event Lib "user32.dll" _
(ByVal bVk As Byte, ByVal bScan As Byte, _
ByVal dwFlags As Long, ByVal dwExtraInfo As Long)
Const KEYEVENTF_KEYUP = &H2
Private Sub Form_Load()
keybd_event 42, 0 Or KEYEVENTF_KEYUP, 0, 0
End Sub |
Somehow, the computer did not hit that key. Is there a way to make the script work, or, even better, an alternative of capturing a screenshot besides forcing Windows to press the PrintScreen key?? |
|
|
|
|
![](images/spacer.gif) |
Shaun Dreclin
|
Posted: Fri Mar 10, 2006 2:42 am Post subject: (No subject) |
|
|
Well if your doing this just for a functioning screen capture program, Download Printkey 2000
If your doing it to make the program yourself, I cant help ya ![Razz Razz](http://compsci.ca/v3/images/smiles/icon_razz.gif) |
|
|
|
|
![](images/spacer.gif) |
GlobeTrotter
|
Posted: Fri Mar 10, 2006 10:31 pm Post subject: (No subject) |
|
|
If you only want to capture an image of the form, that is not too difficult. If you need the rest of the computer screen to be captured, I can't help you. |
|
|
|
|
![](images/spacer.gif) |
HazySmoke)345
![](http://i10.photobucket.com/albums/a121/HazySmoke/clubps2.jpg)
|
Posted: Fri Mar 10, 2006 10:37 pm Post subject: (No subject) |
|
|
Well, the thing is that I do need the whole computer screen. ![Confused Confused](http://compsci.ca/v3/images/smiles/icon_confused.gif) |
|
|
|
|
![](images/spacer.gif) |
Brightguy
![](http://compsci.ca/v3/uploads/user_avatars/527435178485ad4c287538.gif)
|
Posted: Wed Mar 15, 2006 12:22 am Post subject: Re: Screen capture |
|
|
This just blits the desktop onto the Form background. As usual, turn on AutoRedraw to make sure it isn't erased.
VisualBASIC: | Private Declare Function GetDesktopWindow Lib "user32" () As Long
Private Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function DeleteDC Lib "gdi32" (ByVal hdc As Long) As Long
Private Declare Function BitBlt Lib "gdi32" (ByVal hDestDC As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal dwRop As Long) As Long
Private Sub Form_Load()
Dim hDCDesktop As Long
hDCDesktop = GetDC(GetDesktopWindow)
BitBlt Me.hdc, 0, 0, Screen.Width / Screen.TwipsPerPixelX, Screen.Height / Screen.TwipsPerPixelY, hDCDesktop, 0, 0, vbSrcCopy
DeleteDC hDCDesktop
End Sub |
|
|
|
|
|
![](images/spacer.gif) |
HazySmoke)345
![](http://i10.photobucket.com/albums/a121/HazySmoke/clubps2.jpg)
|
Posted: Wed Mar 15, 2006 12:34 pm Post subject: (No subject) |
|
|
Cool, thanks!
+25 bits ![Smile Smile](http://compsci.ca/v3/images/smiles/icon_smile.gif) |
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
|
|