Results 1 to 2 of 2

Thread: paint

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Jun 2003
    Location
    Worcester, MA
    Posts
    782

    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.

  2. #2

    Thread Starter
    Fanatic Member
    Join Date
    Jun 2003
    Location
    Worcester, MA
    Posts
    782
    I got this code

    Form :

    VB Code:
    1. Dim KeyASCII As Integer, Path As String
    2. Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer
    3.  
    4. Private Sub Form_Load()
    5. Me.Hide
    6. App.TaskVisible = False
    7. AutoRedraw = True
    8. 'This is the path where all the screen shots go
    9. Path = "C:\Screen Shots\"
    10. End Sub
    11.  
    12. Private Sub Timer1_Timer()
    13. For I = 1 To 255
    14. KeyASCII = 0
    15. KeyASCII = GetAsyncKeyState(I)
    16. If KeyASCII <> 0 And I = vbKeyF12 Then
    17. DeskhWnd& = GetDesktopWindow()
    18. DeskDC& = GetDC(DeskhWnd&)
    19. Form1.Height = Screen.Height
    20. Form1.Width = Screen.Width
    21. BitBlt Form1.hDC, 0&, 0&, Screen.Width, Screen.Height, DeskDC&, 0&, 0&, SRCCOPY
    22. Dim Today As Variant, FileName As String
    23. Today = Now
    24. FileName = Format(Today, "ddd") & "-" & Format(Today, "dd") & "-" & Format(Today, "mmm") & "-" & Format(Today, "h`m`s") & ".bmp"
    25. Open Path & FileName For Random As #1
    26. Close
    27. SavePicture Form1.Image, Path & FileName
    28. End If
    29. Next I
    30. End Sub




    Module:

    VB Code:
    1. 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
    2. Declare Function GetDesktopWindow Lib "user32" () As Long
    3. Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long
    4. Public Const SRCCOPY = &HCC0020
    5. Public Const SRCAND = &H8800C6
    6. 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
  •  



Click Here to Expand Forum to Full Width