Results 1 to 3 of 3

Thread: VB6 Capture Pixel from Screen

  1. #1

    Thread Starter
    Member
    Join Date
    Aug 2020
    Location
    Victoria Texas 77904
    Posts
    59

    VB6 Capture Pixel from Screen

    Gets the pixel color from desktop. Can keep up to 5 colors per session. I find it very helpful when creating graphics for my apps.
    Give it a try. Enjoy. (please no comments on this or the world will come to an end. haha)
    Attached Images Attached Images  
    Attached Files Attached Files

  2. #2
    PowerPoster Elroy's Avatar
    Join Date
    Jun 2014
    Location
    Near Nashville TN
    Posts
    6,703

    Re: VB6 Capture Pixel from Screen

    Hi Ken,

    To do this, I typically do a screen-capture and then take the image to something like Paint-Shop-Pro to get exact colors. But your idea is pretty cool.

    However, a couple of suggestions if you don't mind. Yeah, I saw your "no comments" request, but isn't that what these forums are about?

    1) Please make your three reporting boxes into locked TextBoxes. That way, we can copy those values. We might be after a hex value or one of the RGB decimal values, rather than the Long.

    2) You're reporting the Hex value as GBR, which is the way VB does it. However, much of the rest of the world reports these hex colors as RGB, such as pretty much all "paint" type programs as well as any HTML color. So, if you could also have a "Hex (RGB)" option, that would be very nice.

    3) How about a set of option buttons to say what goes into the clipboard, such as: Long value, Hex(GBR), Hex(RGB), RGB csv decimal.

    4) Your "use saved color" explanation is a bit confusing to me. How about this: "To use saved color, click the saved color box you wish to use, then capture your color."

    5) Also, to make my suggestion #1 useful, two versions of each of the textboxes would be nice: 1) current hover color, 2) prev captured color. Or, another alternative for this would be as follows: Have some on/off toggle button for whether or not your program is doing its color tracking, and, when a color is captured, turn it off and make the user turn it back on to capture another color. Just an idea.

    6) Also, it's a bit confusing that your program still "sort of" works when it doesn't have the focus. I'm glad I can still use the clipboard for my own purposes in that case, but your program still "sort of" captures the color.

    Again, nice little utility.

    ---------

    EDIT: It's a bit tricky knowing whether or not you've got the focus (system wide). It actually takes a touch of subclassing, and I'm not sure whether or not you're into that. But, if you're so inclined to put this into your project, here's a link to a codebank post I just made. It's in other old threads, but I decided to go ahead and put it in the codebank.
    Last edited by Elroy; Aug 20th, 2021 at 12:52 PM.
    Any software I post in these forums written by me is provided “AS IS” without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge and without restriction, to any person obtaining a copy. Please understand that I’ve been programming since the mid-1970s and still have some of that code. My contemporary VB6 project is approaching 1,000 modules. In addition, I have a “VB6 random code folder” that is overflowing. I’ve been at this long enough to truly not know with absolute certainty from whence every single line of my code has come, with much of it coming from programmers under my employ who signed intellectual property transfers. I have not deliberately attempted to remove any licenses and/or attributions from any software. If someone finds that I have inadvertently done so, I sincerely apologize, and, upon notice and reasonable proof, will re-attach those licenses and/or attributions. To all, peace and happiness.

  3. #3

    Thread Starter
    Member
    Join Date
    Aug 2020
    Location
    Victoria Texas 77904
    Posts
    59

    Re: VB6 Capture Pixel from Screen

    Quote Originally Posted by Elroy View Post
    Hi Ken,

    To do this, I typically do a screen-capture and then take the image to something like Paint-Shop-Pro to get exact colors. But your idea is pretty cool.

    However, a couple of suggestions if you don't mind. Yeah, I saw your "no comments" request, but isn't that what these forums are about?

    1) Please make your three reporting boxes into locked TextBoxes. That way, we can copy those values. We might be after a hex value or one of the RGB decimal values, rather than the Long.

    2) You're reporting the Hex value as GBR, which is the way VB does it. However, much of the rest of the world reports these hex colors as RGB, such as pretty much all "paint" type programs as well as any HTML color. So, if you could also have a "Hex (RGB)" option, that would be very nice.

    3) How about a set of option buttons to say what goes into the clipboard, such as: Long value, Hex(GBR), Hex(RGB), RGB csv decimal.

    4) Your "use saved color" explanation is a bit confusing to me. How about this: "To use saved color, click the saved color box you wish to use, then capture your color."

    5) Also, to make my suggestion #1 useful, two versions of each of the textboxes would be nice: 1) current hover color, 2) prev captured color. Or, another alternative for this would be as follows: Have some on/off toggle button for whether or not your program is doing its color tracking, and, when a color is captured, turn it off and make the user turn it back on to capture another color. Just an idea.

    6) Also, it's a bit confusing that your program still "sort of" works when it doesn't have the focus. I'm glad I can still use the clipboard for my own purposes in that case, but your program still "sort of" captures the color.

    Again, nice little utility.

    ---------

    EDIT: It's a bit tricky knowing whether or not you've got the focus (system wide). It actually takes a touch of subclassing, and I'm not sure whether or not you're into that. But, if you're so inclined to put this into your project, here's a link to a codebank post I just made. It's in other old threads, but I decided to go ahead and put it in the codebank.
    Elroy ,I avoid subclassing at all cost. This app works okay for me, so i'm not planning on any improvements. But feel free to take it and add to 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
  •  



Click Here to Expand Forum to Full Width