Welcome! Log In Create A New Profile

Advanced

WD17 Windows API BitBlt and ImageControl

Posted by Pragma Tix 
Pragma Tix
WD17 Windows API BitBlt and ImageControl
October 10, 2012 10:38PM
Hi
How to use the Windows API BitBlt function in conjunction with an WD Image control. What I want to archieve is to copy f.e. a button, as bitmap into an imagecontrol.
Q : How to use BitBlt with and Image control ?
TIA,
#pragma

The following does not work.

PROCEDURE CopyControlToImage()
rectangle is structure
	l is int
	t is int
	r is int
	b is int
END
rect is rectangle

//hwnd is int = Handle(IMG_DROP)      
hwndControl is int = Handle(CONTROL)   // control handle can be button edit control etc.

hdcControl is system int = API( "user32","GetDC" , hwndControl)

// Get size
API("user32","GetWindowRect" , hwndControl , &rect)

HORZRES is int  = rect.r - rect.l
VERTRES is int = rect.b - rect.t
IMG_DROP..Width=HORZRES
IMG_DROP..Height=VERTRES

dc is system int = dStartDrawing(IMG_DROP)

IF NOT API("gdi32","BitBlt" , dc , 0 , 0 , IMG_DROP..Width , IMG_DROP..Height , hdcControl , 0 , 0 , 0xCC00200) THEN
	Error("BitBlt fails")  // This does not happen.
END

//Cleanup
API("user32","ReleaseDC",hwndControl,hdcControl)
dEndDrawing()



Edited 2 time(s). Last edit at 10/10/2012 10:41PM by Pragma Tix.
Kingdr8
Re: WD17 Windows API BitBlt and ImageControl
October 11, 2012 12:24AM
I use this instead:

dCopyBlt(imgControlSrc,imgControlDest,copySrcAnd, nSrcX,nSrcY,nSrcHeight,nSrcWidth,nDestX,nDestY,nDestHeight,nDestWidth)

HTH

Cheers
King
Pragma Tix
Re: WD17 Windows API BitBlt and ImageControl
October 11, 2012 12:46AM
Quote
Kingdr8
I use this instead:

dCopyBlt(imgControlSrc,imgControlDest,copySrcAnd, nSrcX,nSrcY,nSrcHeight,nSrcWidth,nDestX,nDestY,nDestHeight,nDestWidth)

HTH

Cheers
King

Unfortunately that's not an option.

Let me explain, for instance ..
My window contains 2 controls, a Button and an Image Control.
Now I have to transfer The Button, more exactly , a picture of said button, into the image control

Therefore I have to use the GDI function GetDC(Handle(Button)) to get the Button's Device context.
Now
dc = StartDrawing(Image) will give me the target device context.
Finally I have to use the GDI function BitBlt to copy a picture of the button into the Image control.
I think I miss something.. Maybe I have to create a BitMap, create a compatibleDC etc. I just don't know..yet.
#pragma
Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: