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. BitBlt LoadImage

BitBlt LoadImage

Scheduled Pinned Locked Moved Visual Basic
graphicsquestion
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.
  • F Offline
    F Offline
    Fade Amit BS
    wrote on last edited by
    #1

    :(( Can someone PLEASE tell me why this won't work? :(( **_******** Declarations ********_** Private Declare Auto Function BitBlt Lib "GDI32.DLL" ( byVal hdcDest As IntPtr, ByVal nXDest As Integer, _ ByVal nYDest As Integer, ByVal nWidth As Integer, ByVal nHeight As Integer, ByVal hdcSrc As Long, ByVal nXSrc As Integer, ByVal nYSrc As Integer, ByVal dwRop As Int32) As Boolean Private Declare Function LoadImage Lib "user32" Alias "LoadImageA" (ByVal hInst As Long, ByVal lpsz As String, _ ByVal dwImageType As Long, ByVal dwDesiredWidth As Long, ByVal dwDesiredHeight As Long, ByVal dwFlags As Long) As Long Private Declare Function CreateCompatibleDC Lib "gdi32" (ByVal hdc As Long) As Long Private Declare Function SelectObject Lib "gdi32" (ByVal hdc As Long, ByVal hObject As Long) As Long Private Declare Function DeleteDC Lib "gdi32" (ByVal hdc As Long) As Long Private Declare Function DeleteObject Lib "gdi32" (ByVal hObject As Long) As Long **_******** Consts ********_** Private Const LR_LOADFROMFILE = &H10 Private Const IMAGE_BITMAP = 0 Private SRCCOPY as Integer = &HCC0020 **_******** Sub that won't work ********_**

     Private Sub ShowPicture(ByVal File As String)
            Dim MemBmpHandle As Long
            Dim MemHdc As Long
            Dim Result As Long
    '
            MemBmpHandle = LoadImage(0, File, IMAGE_BITMAP, 776, 84, LR_LOADFROMFILE)
            MemHdc = CreateCompatibleDC(0)
            Result = SelectObject(MemHdc, MemBmpHandle)
    ' 
            Dim Grp As Graphics = PictureBox1.CreateGraphics ' Creating graphics object to BitBlt on
            Dim TargetDC As IntPtr = Grp.GetHdc() 'Creating target HDC
    '
            BitBlt(TargetDC, 0, 0, 776, 84, MemHdc, 0, 0, SRCCOPY) ' Blitting'
    
            Grp.ReleaseHdc(TargetDC)
            Grp.Dispose()
            DeleteDC(MemHdc)
            DeleteObject(MemBmpHandle)
        End Sub
    

    Fade (Amit BS)

    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