Page 1 of 2 12 LastLast
Results 1 to 40 of 43

Thread: screen capture

  1. #1

    Thread Starter
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    25,464

    screen capture

    here's my screen capture application

    edit: see updated version - post #14
    Attached Images Attached Images  
    Attached Files Attached Files
    Last edited by .paul.; Oct 13th, 2009 at 08:35 AM.

  2. #2
    Fanatic Member manhit45's Avatar
    Join Date
    May 2009
    Location
    Ha noi - Viet Nam
    Posts
    826

    Re: screen capture

    Thanks for example. please guid me about it.

    how can i capture .
    --***----------***-----

    If i help you please rate me.

    Working with Excel * Working with String * Working with Database * Working with array *

    K51 ĐH BÁCH KHOA HÀ NỘI - Khoa CNTT pro.

  3. #3
    Addicted Member
    Join Date
    Apr 2009
    Location
    Near Dog River (sorta)
    Posts
    160

    Re: screen capture

    Quote Originally Posted by manhit45 View Post
    Thanks for example. please guid me about it.

    how can i capture .
    You're kidding, right?
    PC #1: Athlon64 X2+Vista64+VS2008EE+.NET3.5 #2: XP (all flavours Ghost'd)+VS2008EE+.NET3.5
    Help Files: HelpMaker · Dr. Explain · Create Icons: IcoFX


    "Whoever eats my flesh and drinks my blood has eternal life, and I will raise him on the last day." John 6:54

  4. #4

    Thread Starter
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    25,464

    Re: screen capture

    press your PrtScrn button.

    for capturing selected rectangle, press your PrtScrn button, select an area, then press your PrtScrn button again.

  5. #5
    Master Of Orion ForumAccount's Avatar
    Join Date
    Jan 2009
    Location
    Canada
    Posts
    2,802

    Re: screen capture

    1) Doesn't work properly with dual monitors - only captures primary monitor, same with rectangle selection.
    2) There are two shared member warnings: lines 143, 145
    3) You should delete the bin/obj folders...

    Other then that, it works good.

  6. #6

    Thread Starter
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    25,464

    Re: screen capture

    Quote Originally Posted by ForumAccount View Post
    1) Doesn't work properly with dual monitors - only captures primary monitor, same with rectangle selection.
    2) There are two shared member warnings: lines 143, 145
    3) You should delete the bin/obj folders...

    Other then that, it works good.
    1/ i can't change that. no way for me to test it.
    2/ i don't get a warning on those lines
    3/ i deleted the binaries

    Other than that, thanks

  7. #7
    Master Of Orion ForumAccount's Avatar
    Join Date
    Jan 2009
    Location
    Canada
    Posts
    2,802

    Re: screen capture

    Are warnings suppressed in your projects?

  8. #8

    Thread Starter
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    25,464

    Re: screen capture

    no. i just turned all warnings + option strict on. got a lot of warnings, but not that. it must be something to do with dual screens

  9. #9
    Master Of Orion ForumAccount's Avatar
    Join Date
    Jan 2009
    Location
    Canada
    Posts
    2,802

    Re: screen capture

    Code:
    #Region "     notifyicon"
    
        Private Sub ni1_MouseDoubleClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles ni1.MouseDoubleClick
            Me.Show()
            If e.Button = MouseButtons.Left And Me.WindowState = FormWindowState.Minimized Then
                Me.WindowState = FormWindowState.Normal
            ElseIf e.Button = MouseButtons.Left And Me.WindowState = FormWindowState.Normal Then
                Me.Activate()
            End If
        End Sub
    
    #End Region

  10. #10

    Thread Starter
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    25,464

    Re: screen capture

    try changing them to
    vb Code:
    1. System.Windows.Forms.MouseButtons.Left

    shouldn't need to though. the reference is there.

  11. #11
    Member
    Join Date
    Dec 2008
    Posts
    49

    Re: screen capture

    It won't work with 2010 Express

  12. #12

    Re: screen capture

    Quote Originally Posted by austinjf785 View Post
    It won't work with 2010 Express
    Not much help there. What's wrong, we need the error information (more specifically .paul. does)

  13. #13
    ASP.NET Moderator gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    Re: screen capture

    Hey,

    I didn't think that Visual Studio 2010 Express had been released.

    Am I missing something?

    Gary

  14. #14

    Thread Starter
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    25,464

    Re: screen capture (New version: (VB2008) dual screen capture)

    heres an updated version. i've upgraded it to VB2008, + added support for dual monitors.
    it now captures:
    1/ (either) whole screen, depending where the cursor is.
    2/ the active window, whichever screen its displayed on.
    3/ a selected rectangle from either screen again depending where the cursor is.

    Originally Posted by austinjf785
    It won't work with 2010 Express
    Originally Posted by gep13
    I didn't think that Visual Studio 2010 Express had been released.
    neither did i
    Attached Files Attached Files

  15. #15
    Master Of Orion ForumAccount's Avatar
    Join Date
    Jan 2009
    Location
    Canada
    Posts
    2,802

    Re: screen capture

    It's not, he must mean the Beta.

  16. #16
    ASP.NET Moderator gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    Re: screen capture

    Hey,

    I am running the Beta 1 of Visual Studio 2010, but I didn't think there was a Beta of the Express Editions, if so, where is the download, would be interesting to have a look!

    Good work by the way Paul.

    Gary

  17. #17
    Registered User
    Join Date
    Jul 2009
    Posts
    71

    Re: screen capture

    I like your project, especially how you've made the rectangle selection work.

    However, to be honest the selection is drawn quite slowly. It might be my computer that is the problem, but invalidating the form every time the cursor moves doesn't really give a decent speed to an application.
    Another tip, you should save screenshots in .png format, not in .jpg. The quality of .jpg is very bad for screenshots whereas there's no quality lose in the .png format.

    Other than that it's been very helpful for me. Thanks.

  18. #18
    ASP.NET Moderator gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    Re: screen capture

    Hey,

    This is an open forum, and I am sure .paul. wouldn't find if you took his code and submitted your own changes/improvements.

    Gary

  19. #19

    Thread Starter
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    25,464

    Re: screen capture

    Quote Originally Posted by gep13 View Post
    Hey,

    This is an open forum, and I am sure .paul. wouldn't find if you took his code and submitted your own changes/improvements.

    Gary
    no i probably wouldn't find + i wouldn't mind either. if you can improve it, go for it.


    Quote Originally Posted by pimvdb View Post
    I like your project, especially how you've made the rectangle selection work.

    However, to be honest the selection is drawn quite slowly. It might be my computer that is the problem, but invalidating the form every time the cursor moves doesn't really give a decent speed to an application.
    Another tip, you should save screenshots in .png format, not in .jpg. The quality of .jpg is very bad for screenshots whereas there's no quality lose in the .png format.

    Other than that it's been very helpful for me. Thanks.
    jpeg provides good enough quality for me. the invalidating is necessary to redraw the selection rectangle, + it works ok on my pc, but maybe not on an older or less powerful pc

  20. #20
    ASP.NET Moderator gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    Re: screen capture

    Quote Originally Posted by .paul. View Post
    no i probably wouldn't find + i wouldn't mind either. if you can improve it, go for it.
    Doh!! Damn my bad typing

  21. #21
    Registered User
    Join Date
    Jul 2009
    Posts
    71

    Re: screen capture

    Actually I already tried to enhance the speed, but with no luck. Removing the invalidating part even didn't matter, it was painted well without but didn't speed up the whole. My computer sure isn't the best out there but I'll keep trying

  22. #22
    Fanatic Member Emcrank's Avatar
    Join Date
    Jan 2009
    Posts
    566

    Re: screen capture

    doesn't work, i get Object reference not set to an instance of an object.
    at this part.
    Code:
            regShell = regKey.OpenSubKey("Software\Microsoft\Windows\CurrentVersion\Run", False)
            If LCase(regShell.GetValue("screen capture").ToString) = Application.ExecutablePath.ToLower Then    <--- this line
                RunToolStripMenuItem.Checked = True
            End If

  23. #23
    ASP.NET Moderator gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    Re: screen capture

    Which part of that code actually throws the error? Have you tried stepping into it with the debugger?

    Gary

  24. #24

  25. #25
    ASP.NET Moderator gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    Re: screen capture

    Oops, I never scrolled right, my bad...

    In your code, you should get that this:

    Code:
    regShell.GetValue("screen capture")
    Isn't returning null/Nothing, before accessing a member of that variable. Are you sure you have a reg key with that name set up?

    Gary

  26. #26

  27. #27
    ASP.NET Moderator gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    Re: screen capture

    Interesting.

    I think this might be a slight glitch with the problem, that wasn't highlighted in initial testing, as that registry key would have already been in place.

    Try changing that section of the code to something like the following:

    Code:
            regShell = regKey.OpenSubKey("Software\Microsoft\Windows\CurrentVersion\Run", False)
            If Not regShell.GetValue("screen capture") Is Nothing Then
                If LCase(regShell.GetValue("screen capture").ToString) Is Application.ExecutablePath.ToLower Then
                    RunToolStripMenuItem.Checked = True
                End If
            End If
    That should get it to work.

    Gary

  28. #28

  29. #29

    Thread Starter
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    25,464

    Re: screen capture

    it's minimized to an icon in your system tray

  30. #30
    ASP.NET Moderator gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    Re: screen capture

    double click the system tray icon.

  31. #31

    Thread Starter
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    25,464

    Re: screen capture

    as gary said, double click the system tray icon to restore the options form, or press the prtscr button to capture

  32. #32

  33. #33

  34. #34

    Thread Starter
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    25,464

    Re: screen capture

    no. it saves the image to a folder called images in the app's bin/debug folder

  35. #35
    Member
    Join Date
    Mar 2012
    Posts
    35

    Re: screen capture

    Hello,

    Thanks for the source, its awesome!
    But I need to know one thing.
    If you click prnt screen when you have capture selected rectangle on, you have to click prnt screen again to actually save the image.
    Is there a way to not have to press prnt screen again, so it just saves it whenever you drawn your first rectangle?

    Also when im building the project and I try to run the application it gives me this error, whats wrong?

    Name:  fj83WfwBa4.png
Views: 4442
Size:  105.5 KB

    Thanks,
    Jordy
    Last edited by jordy12345; Apr 3rd, 2013 at 07:15 AM.

  36. #36

    Thread Starter
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    25,464

    Re: screen capture

    Quote Originally Posted by jordy12345 View Post
    Hello,

    Thanks for the source, its awesome!
    But I need to know one thing.
    If you click prnt screen when you have capture selected rectangle on, you have to click prnt screen again to actually save the image.
    Is there a way to not have to press prnt screen again, so it just saves it whenever you drawn your first rectangle?

    Also when im building the project and I try to run the application it gives me this error, whats wrong?

    Name:  fj83WfwBa4.png
Views: 4442
Size:  105.5 KB

    Thanks,
    Jordy
    you could use the mouseup event instead of a 2nd PRTSCR
    as for the error msg, can you translate that into english?

  37. #37
    Member
    Join Date
    Mar 2012
    Posts
    35

    Post Re: screen capture

    Quote Originally Posted by .paul. View Post
    you could use the mouseup event instead of a 2nd PRTSCR
    as for the error msg, can you translate that into english?
    If you wanna see the error yourself, then download the zip here

    screen capture_1_0_0_0.zip

    If you dont want to do that, here is the code translated in google translator.

    Code:
    There is an unhandled exception occurred in the application. If you click Continue, this error is ignored and the application. If you click Quit, the application is immediately closed.
    
    There is a general error occurred in GDI +.
    Code:
    See the end of this message for details on invoking
    JIT (Just In Time) debugging instead of this dialog box.
    
    ************** Exception Text **************
    System.Runtime.InteropServices.ExternalException (0x80004005): There is a general error occurred in GDI +.
    ***at System.Drawing.Image.Save (String filename, Image Codec encoder, Encoder Parameters encoderParams)
    ***screen_capture.Form1.WndProc (Message & m)
    ***at System.Windows.Forms.NativeWindow.Callback (IntPtr hWnd, Int32 msg, IntPtr wParam, IntPtr lParam)
    
    
    ************** Loaded Assemblies **************
    mscorlib
    ****Assembly Version: 4.0.0.0
    ****Win32 Version: 4.0.30319.18034 built by: FX45RTMGDR
    ****Codebase: file :/ / / C :/ Windows/Microsoft.NET/Framework64/v4.0.30319/mscorlib.dll
    ----------------------------------------
    screen capture
    ****Assembly Version: 1.0.0.0
    ****Win32 version: 1.0.0.0
    ****Codebase:
    ----------------------------------------
    Microsoft.VisualBasic
    ****Assembly Version: 10.0.0.0
    ****Win32 version: 11.0.50709.17929 built by FX45RTMREL
    ****Codebase:
    ----------------------------------------
    System
    ****Assembly Version: 4.0.0.0
    ****Win32 Version: 4.0.30319.18034 built by: FX45RTMGDR
    ****Codebase: file :/ / / C :/ WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll
    ----------------------------------------
    System.Core
    ****Assembly Version: 4.0.0.0
    ****Win32 Version: 4.0.30319.17929 built by: FX45RTMREL
    ****Codebase:
    ----------------------------------------
    System.Windows.Forms
    ****Assembly Version: 4.0.0.0
    ****Win32 Version: 4.0.30319.18036 built by: FX45RTMGDR
    ****Codebase:
    ----------------------------------------
    System.Drawing
    ****Assembly Version: 4.0.0.0
    ****Win32 Version: 4.0.30319.18021 built by: FX45RTMGDR
    ****Codebase:
    ----------------------------------------
    System.Runtime.Remoting
    ****Assembly Version: 4.0.0.0
    ****Win32 Version: 4.0.30319.17929 built by: FX45RTMREL
    ****Codebase:
    ----------------------------------------
    System.Configuration
    ****Assembly Version: 4.0.0.0
    ****Win32 Version: 4.0.30319.17929 built by: FX45RTMREL
    ****Codebase:
    ----------------------------------------
    System.Xml
    ****Assembly Version: 4.0.0.0
    ****Win32 Version: 4.0.30319.18034 built by: FX45RTMGDR
    ****Codebase:
    ----------------------------------------
    Accessibility
    ****Assembly Version: 4.0.0.0
    ****Win32 Version: 4.0.30319.17929 built by: FX45RTMREL
    ****Codebase:
    ----------------------------------------
    System.Drawing.resources
    ****Assembly Version: 4.0.0.0
    ****Win32 Version: 4.0.30319.1 built by: RTMRel
    ****Codebase:
    ----------------------------------------
    System.Windows.Forms.resources
    ****Assembly Version: 4.0.0.0
    ****Win32 Version: 4.0.30319.1 built by: RTMRel
    ****Codebase:
    ----------------------------------------
    mscorlib.resources
    ****Assembly Version: 4.0.0.0
    ****Win32 Version: 4.0.30319.1 (RTMRel.030319 0100)
    ****Codebase:
    ----------------------------------------
    
    ************** JIT Debugging **************
    If you want to enable JIT debugging in the configuration file for this
    application or computer (machine.config) the value
    jitDebugging are set in the system.windows.forms section.
    The application must also be compiled with debugging
    was enabled.
    
    For example:
    
    <configuration>
    ****<system.windows.forms jitDebugging="true" Deal
    </ Configuration>
    
    When JIT debugging is enabled, any unhandled exception
    sent to the JIT debugger registered on the computer
    and are not handled by this dialog.

  38. #38

    Thread Starter
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    25,464

    Re: screen capture

    @jordy
    i think you'll find the error is due to filesystem security not allowing file saving in that location.
    try changing the save to folder...

  39. #39
    Member
    Join Date
    Mar 2012
    Posts
    35

    Re: screen capture

    Quote Originally Posted by .paul. View Post
    @jordy
    i think you'll find the error is due to filesystem security not allowing file saving in that location.
    try changing the save to folder...
    Thanks for your reply, the problem was that it couldn't save the picture because there was no images directory in the folder.
    I thought that it would create the folder automaticly, thanks.

  40. #40
    Hyperactive Member
    Join Date
    May 2013
    Posts
    285

    Re: screen capture

    In windows 8 when i press print screen button i am getting error as shown below(tested in about 3 windows 8 pc)

    Name:  untitled.JPG
Views: 3593
Size:  16.7 KB

Page 1 of 2 12 LastLast

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