Mine_23
Feb 17th, 2001, 04:52 AM
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)
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.
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?!
&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.
Lord Orwell
Feb 17th, 2001, 09:35 PM
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.