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. General Programming
  3. Visual Basic
  4. Questions about releasing handles.

Questions about releasing handles.

Scheduled Pinned Locked Moved Visual Basic
graphicshelpannouncement
1 Posts 1 Posters 0 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.
  • G Offline
    G Offline
    gregcost
    wrote on last edited by
    #1

    I Dim a graphic “Public Ax1g1 As Graphics = MYform1.CreateGraphics” and the call the “bitblt” function to capture the image and then I release the handle “Ax1g1.ReleaseHdc(dc1)” On any subsequent call to this class “Ax1ThumbnailClass.AxCaptureImage” I get an invalid parameter exception on Ax1g1.ReleaseHdc(dc1). I’ve tried not releasing the handles and I do not get the exception but the captured image is blank. Help greatly appreciated!!!! ********************CALLING CODE*********************** Ax1Thumbnail.AxCaptureImage(MYform1.AxWebBrowser1.Location.X, MYform1.AxWebBrowser1.Location.Y) Myform2.thumbScr1.Image = Ax1Thumbnail.Ax1Image.GetThumbnailImage(50, 50, Nothing, Nothing) Public Class Ax1ThumbnailClass Public Ax1g1 As Graphics = MYform1.CreateGraphics() Public Ax1Image = New Bitmap(150, 150, Ax1g1) Public Ax1g2 As Graphics = Graphics.FromImage(Ax1Image) Public dc1 As IntPtr = Ax1g1.GetHdc() Public dc2 As IntPtr = Ax1g2.GetHdc() Public Sub AxCaptureImage(ByVal Browser1 As Integer, ByVal Browser2 As Integer) CallBitBlt.BitBlt(dc2, 0, 0, 150, 150, dc1, Browser1, Browser2, SSRCCOPY) Ax1g1.ReleaseHdc(dc1) Ax1g2.ReleaseHdc(dc2) End Sub End Class Public Class bitbltClass _ Public Shared Function BitBlt(ByVal hdcDest As IntPtr, _ ByVal nXDest As Integer, _ ByVal nYDest As Integer, _ ByVal nWidth As Integer, _ ByVal nHeight As Integer, _ ByVal hdcSrc As IntPtr, _ ByVal nXSrc As Integer, _ ByVal nYSrc As Integer, _ ByVal dwRop As System.Int32) As Boolean End Function End Class Thanks, GregC

    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