Results 1 to 5 of 5

Thread: Form HDC!

  1. #1
    Mine_23
    Guest

    Lightbulb

    Hello;
    1) How can I send a picture from a form to another window using HDC ( in API)?


    2) What is the double-click mouse button value? (to use it in sending for a form)

  2. #2
    Guest
    You forogt the last argument of BitBlt, which is the drop code. If you want to copy it directly, use vbSrcCopy. Copy all but black is vbSrcAnd, and copy all but white is vbSrcPaint.

  3. #3
    Guest

    Double-click!

    Double-click

    OK, but I had created a window using CreatewindowEx function, and I put a Double-click in it's class but when I clicked on it nothing had happened (I mad the procedure to process messages)

    messages process procedure:

    Public function CallBack(byval hWnd as long, byval uMsg as long)as long

    if uMsg = &h209 then
    Msgbox "Double-click"
    end if
    CallBack = 1

    end function

    the message doesn't appear when I click on the new window?!

  4. #4
    Guest
    &H209?? That's the constant for the middle button. I'm pretty sure you want &H203, which is the double click for the left button.

  5. #5
    coder. Lord Orwell's Avatar
    Join Date
    Feb 2001
    Location
    Elberfeld, IN
    Posts
    7,628
    My code:

    Declare Function BitBlt Lib "gdi32" (ByVal hDestDC As Long, _
    ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal _
    nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal dwRop As Long) As Long
    Declare Function GetDC Lib "user32" (ByVal Hwnd As Long) As Long
    Declare Function UpdateWindow& Lib "user32" (ByVal Hwnd As Long)
    Private Const SRCCOPY = &HCC0020

    Sub CopyWindowGraphics(SrcHwnd As Long, DestHwnd As Long, XStart As Long, YStart As Long, XEnd As Long, YEnd As Long)
    'keep in mind that while it is possible to read the bitmap picture
    'of any window with this subroutine, only certain window classes
    'are designed to show the result. in vb: Form, Picture box, richtextbox, etc.
    'You can't draw on a standard text box, command button, etc.
    Dim SrcHDC As Long, DestHDC As Long
    SrcHDC = GetDC(SrcHwnd)
    DestHDC = GetDC(DestHwnd)
    Call BitBlt(DestHDC, 0, 0, XEnd - XStart, YEnd - YStart, SrcHDC, XStart, YStart, SRCCOPY)
    UpdateWindow (DestHwnd) 'necessary to show what you did.
    End Sub



    Question 2 notes:
    You should also probably send 3 messages instead of just one. Send these three.
    wm_lbuttondown
    then
    wm_lbuttonup
    then
    wm_lbuttondblclick

    why? Because this is how windows does it. Some programs might just be looking for this.
    My light show youtube page (it's made the news) www.youtube.com/@lightsofelberfeld
    Contact me on the socials www.facebook.com/lordorwell

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