|
-
Oct 12th, 2003, 10:18 AM
#1
Thread Starter
Fanatic Member
paint
I want a program so that when print screen is pressed, print is opened and ctrl v is pressed and then save..... i have 2 questions
a) if i send the key ctrl v while i am running sumthing ( even if i shell paint in the exe) will it affect paint of the current program?
b) how do i send the keys so that it types in the textname of the file and asves it in the right directory?
C#.net, VB, C++, Java, VS 2005/2008
Dont' forget to rate posts that are helpful to you.
-
Oct 12th, 2003, 11:01 AM
#2
Thread Starter
Fanatic Member
I got this code
Form :
VB Code:
Dim KeyASCII As Integer, Path As String
Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer
Private Sub Form_Load()
Me.Hide
App.TaskVisible = False
AutoRedraw = True
'This is the path where all the screen shots go
Path = "C:\Screen Shots\"
End Sub
Private Sub Timer1_Timer()
For I = 1 To 255
KeyASCII = 0
KeyASCII = GetAsyncKeyState(I)
If KeyASCII <> 0 And I = vbKeyF12 Then
DeskhWnd& = GetDesktopWindow()
DeskDC& = GetDC(DeskhWnd&)
Form1.Height = Screen.Height
Form1.Width = Screen.Width
BitBlt Form1.hDC, 0&, 0&, Screen.Width, Screen.Height, DeskDC&, 0&, 0&, SRCCOPY
Dim Today As Variant, FileName As String
Today = Now
FileName = Format(Today, "ddd") & "-" & Format(Today, "dd") & "-" & Format(Today, "mmm") & "-" & Format(Today, "h`m`s") & ".bmp"
Open Path & FileName For Random As #1
Close
SavePicture Form1.Image, Path & FileName
End If
Next I
End Sub
Module:
VB Code:
Declare Function BitBlt Lib "gdi32" (ByVal hDestDC As Integer, ByVal x As Integer, ByVal y As Integer, ByVal nWidth As Integer, ByVal nHeight As Integer, ByVal hSrcDC As Integer, ByVal xSrc As Integer, ByVal ySrc As Integer, ByVal dwRop As Long) As Integer
Declare Function GetDesktopWindow Lib "user32" () As Long
Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long
Public Const SRCCOPY = &HCC0020
Public Const SRCAND = &H8800C6
Public Const SRCINVERT = &H660046
When i run it and press F12 i get an overflow error... can anyone help?
C#.net, VB, C++, Java, VS 2005/2008
Dont' forget to rate posts that are helpful to you.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|