Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. Old news but worth noting Graphics.FromHwnd and Spy++

Old news but worth noting Graphics.FromHwnd and Spy++

Scheduled Pinned Locked Moved The Lounge
graphicshelpannouncement
5 Posts 5 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • I Offline
    I Offline
    icestatue
    wrote on last edited by
    #1

    I went looking for a resolution to a small problem with using Graphics.FromHwnd and getting an OutOfMemory Exception. It turns out if the handle number that is entered is invalid, then this exception is thrown. If you are using Spy++ to retrieve handle numbers keep in mind that these numbers are in Hex and need to be converted to base 10 format if you want this to work or try something like this TryParse statement to convert the Hexadecimal numbers for you.

    int.TryParse(textBox1.Text, System.Globalization.NumberStyles.AllowHexSpecifier, null, out _int)

    nothing

    M H 2 Replies Last reply
    0
    • I icestatue

      I went looking for a resolution to a small problem with using Graphics.FromHwnd and getting an OutOfMemory Exception. It turns out if the handle number that is entered is invalid, then this exception is thrown. If you are using Spy++ to retrieve handle numbers keep in mind that these numbers are in Hex and need to be converted to base 10 format if you want this to work or try something like this TryParse statement to convert the Hexadecimal numbers for you.

      int.TryParse(textBox1.Text, System.Globalization.NumberStyles.AllowHexSpecifier, null, out _int)

      nothing

      M Offline
      M Offline
      mav northwind
      wrote on last edited by
      #2

      What does this have to do in the lounge?

      Regards, mav -- Black holes are the places where God divided by 0...

      OriginalGriffO realJSOPR 2 Replies Last reply
      0
      • M mav northwind

        What does this have to do in the lounge?

        Regards, mav -- Black holes are the places where God divided by 0...

        OriginalGriffO Offline
        OriginalGriffO Offline
        OriginalGriff
        wrote on last edited by
        #3

        ...ignoring the fact that it is pretty obvious anyway...

        Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together. Manfred R. Bihy: "Looks as if OP is learning resistant."

        "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
        "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

        1 Reply Last reply
        0
        • I icestatue

          I went looking for a resolution to a small problem with using Graphics.FromHwnd and getting an OutOfMemory Exception. It turns out if the handle number that is entered is invalid, then this exception is thrown. If you are using Spy++ to retrieve handle numbers keep in mind that these numbers are in Hex and need to be converted to base 10 format if you want this to work or try something like this TryParse statement to convert the Hexadecimal numbers for you.

          int.TryParse(textBox1.Text, System.Globalization.NumberStyles.AllowHexSpecifier, null, out _int)

          nothing

          H Offline
          H Offline
          Henry Minute
          wrote on last edited by
          #4

          If you have something like this that you feel worth passing on to other members, you should do so at Tips/Tricks[^].

          Henry Minute Do not read medical books! You could die of a misprint. - Mark Twain Girl: (staring) "Why do you need an icy cucumber?" “I want to report a fraud. The government is lying to us all.” I wouldn't let CG touch my Abacus! When you're wrestling a gorilla, you don't stop when you're tired, you stop when the gorilla is.

          1 Reply Last reply
          0
          • M mav northwind

            What does this have to do in the lounge?

            Regards, mav -- Black holes are the places where God divided by 0...

            realJSOPR Offline
            realJSOPR Offline
            realJSOP
            wrote on last edited by
            #5

            mav.northwind wrote:

            What does this have to do in the lounge?

            It's got words in it. What do I win?

            ".45 ACP - because shooting twice is just silly" - JSOP, 2010
            -----
            You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
            -----
            "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass." - Dale Earnhardt, 1997

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups