dcsimg
Results 1 to 10 of 10

Thread: [RESOLVED] how to screen capture with mouse cursor and with click right and left

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Sep 2013
    Posts
    165

    Resolved [RESOLVED] how to screen capture with mouse cursor and with click right and left

    Hello,
    I want the screen captcha with mouse cursor and with click right and left using timer.
    screen captcha make pictures are good saved my folder but I want when screen captcha start mouse cursor click show in picture how can do?
    i used this code screen captcha
    Private Sub ScreenCapToPictureBox(pic As PictureBox)
    Dim oldscalemode As Long
    Dim oldredraw As Boolean
    Dim DeskDC As Long
    Dim DeskWnd As Long
    Dim CurInfo As T_CURSORINFO
    Dim scrn_width As Long
    Dim scrn_height As Long
    Dim pic_width As Long
    Dim pic_height As Long
    oldscalemode = pic.ScaleMode
    oldredraw = pic.AutoRedraw
    pic.AutoRedraw = True
    pic.ScaleMode = vbPixels
    DeskWnd = GetDesktopWindow()
    DeskDC = GetDC(DeskWnd)
    scrn_width = Screen.Width \ Screen.TwipsPerPixelX
    scrn_height = Screen.Height \ Screen.TwipsPerPixelY
    pic_width = pic.ScaleWidth
    pic_height = pic.ScaleHeight
    Call StretchBlt(pic.hDC, 0, 0, _
    pic.ScaleWidth, _
    pic.ScaleHeight, _
    DeskDC, 0, 0, _
    scrn_width, _
    scrn_height, _
    vbSrcCopy)
    Call ReleaseDC(DeskWnd, DeskDC)
    CurInfo.cbSize = Len(CurInfo)
    Call GetCursorInfo(CurInfo)
    If (CurInfo.flags And CURSOR_SHOWING) Then
    Call DrawIcon(pic.hDC, _
    CurInfo.ptScreenPos.x * (pic_width / scrn_width), _
    CurInfo.ptScreenPos.y * (pic_height / scrn_height), _
    CurInfo.hCursor)
    End If
    pic.Refresh
    pic.AutoRedraw = oldredraw
    pic.ScaleMode = oldscalemode
    End Sub
    What do I insert into it so that the mouse clicks appear?

    when i click drive not show click picture

    for example see picture
    Attached Images Attached Images   

  2. #2
    PowerPoster
    Join Date
    Dec 2004
    Posts
    24,658

    Re: how to screen capture with mouse cursor and with click right and left

    use code tags when posting code
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

  3. #3
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    18,572

    Re: how to screen capture with mouse cursor and with click right and left

    consider searching this forum for examples of: RegisterHotKey
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  4. #4
    Addicted Member
    Join Date
    Jun 2018
    Posts
    177

    Re: how to screen capture with mouse cursor and with click right and left


  5. #5
    Frenzied Member
    Join Date
    Dec 2008
    Posts
    1,263

    Re: how to screen capture with mouse cursor and with click right and left

    You used the term captcha a couple of times. Are you referring to this -
    "A CAPTCHA is a type of challenge–response test used in computing to determine whether or not the user is human. The term was coined in 2003 by Luis von Ahn, Manuel Blum, Nicholas J. Hopper, and John Langford. The most common type of CAPTCHA was first invented in 1997 by two groups working in parallel. Wikipedia"

    That is something I would like removed from the history of the universe.
    Is that what you are requesting assistance on ?
    Rob
    PS Why not attach your project. That may help us understand your problem/request

  6. #6
    PowerPoster
    Join Date
    Dec 2004
    Posts
    24,658

    Re: how to screen capture with mouse cursor and with click right and left

    You used the term captcha a couple of times
    just bad translation i reckon
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

  7. #7
    Addicted Member
    Join Date
    Mar 2017
    Posts
    192

    Re: how to screen capture with mouse cursor and with click right and left

    Quote Originally Posted by kako0000000 View Post
    Hello,
    I want the screen captcha with mouse cursor and with click right and left using timer.
    screen captcha make pictures are good saved my folder but I want when screen captcha start mouse cursor click show in picture how can do?
    i used this code screen captcha

    when i click drive not show click picture
    I'm a little confused about the OP's request but based on what he posted I get the idea that he wants to mouse click on a drive icon; "when i click drive not show click picture", and as shown in one of the attached images, and then place that image into a picturebox. OP mentions that he wants to use a timer as stated here: "with mouse cursor and with click right and left using timer" but he does not include the timer event code so maybe he wants someone to write it for him. I have no idea how that would/could work.

    I downloaded the project posted in #4 but I don't see where that code has much to do with OP's request. I ran the project and all I see that it does is capture the entire screen when you click the button. I don't understand the reason for the timer event however.

    Could someone with more experience than me please explain what they think if not the same as what I think

  8. #8
    Addicted Member
    Join Date
    Jun 2018
    Posts
    177

    Re: how to screen capture with mouse cursor and with click right and left

    Quote Originally Posted by Ordinary Guy View Post
    I downloaded the project posted in #4 but I don't see where that code has much to do with OP's request. I ran the project and all I see that it does is capture the entire screen when you click the button. I don't understand the reason for the timer event however.
    Hello,

    The specialty of the sample in Post #4 is it does display the mouse icon on the screen capture, which might OP basically needs.

    As far as I understand, the mouse pointer and the on screen graphics handle separately. So if you need a screen capture with the mouse pointer, you need special techniques to combine them. The timer in the sample exactly does it. It gets the cursor location and draw the mouse icon separately on the screen capture.

    However, I am also not sure what op needs here: "... with click right and left using timer"

  9. #9

    Thread Starter
    Addicted Member
    Join Date
    Sep 2013
    Posts
    165

    Re: how to screen capture with mouse cursor and with click right and left

    i solved it problem i used this code

    Private Sub ScreenCapToPictureBox(pic As PictureBox)
    Dim oldscalemode As Long
    Dim oldredraw As Boolean
    Dim DeskDC As Long
    Dim DeskWnd As Long
    Dim CurInfo As T_CURSORINFO
    Dim scrn_width As Long
    Dim scrn_height As Long
    Dim pic_width As Long
    Dim pic_height As Long
    oldscalemode = pic.ScaleMode
    oldredraw = pic.AutoRedraw
    pic.AutoRedraw = True
    pic.ScaleMode = vbPixels
    DeskWnd = GetDesktopWindow()
    DeskDC = GetDC(DeskWnd)
    scrn_width = Screen.Width \ Screen.TwipsPerPixelX
    scrn_height = Screen.Height \ Screen.TwipsPerPixelY
    pic_width = pic.ScaleWidth
    pic_height = pic.ScaleHeight
    Call StretchBlt(pic.hDC, 0, 0, _
    pic.ScaleWidth, _
    pic.ScaleHeight, _
    DeskDC, 0, 0, _
    scrn_width, _
    scrn_height, _
    vbSrcCopy)
    Call ReleaseDC(DeskWnd, DeskDC)
    CurInfo.cbSize = Len(CurInfo)
    Call GetCursorInfo(CurInfo)
    If (CurInfo.flags And CURSOR_SHOWING) Then

    If GetAsyncKeyState(VK_LBUTTON) Then
    BitBlt Picture1.hDC, -13 + CurInfo.ptScreenPos.x * (pic_width / scrn_width), -10 + CurInfo.ptScreenPos.y * (pic_height / scrn_height), 32, 33, PicMk.hDC, 0, 0, vbSrcAnd
    ElseIf GetAsyncKeyState(VK_RBUTTON) Then
    BitBlt Picture1.hDC, -13 + CurInfo.ptScreenPos.x * (pic_width / scrn_width), -10 + CurInfo.ptScreenPos.y * (pic_height / scrn_height), 32, 33, PicLk.hDC, 0, 0, vbSrcAnd
    Else
    Call DrawIcon(pic.hDC, CurInfo.ptScreenPos.x * (pic_width / scrn_width), _
    CurInfo.ptScreenPos.y * (pic_height / scrn_height), _
    CurInfo.hCursor)
    End If
    End If

    pic.Refresh
    pic.AutoRedraw = oldredraw
    pic.ScaleMode = oldscalemode
    End Sub

  10. #10
    Addicted Member
    Join Date
    Mar 2017
    Posts
    192

    Re: [RESOLVED] how to screen capture with mouse cursor and with click right and left

    I sure glad you figured it out because I don't have the slightest idea what your code does or how to use it

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width