StretchBlt difficulty with forms with TransparentColor = True

I am using the StretchBlt windows function to create a magnifier that follows the mouse in one of my applications,  However it does not "see" a Delphi form that has the TransparentColor property set to true.

I discovered long ago that when using BitBlt to take a screenshot I had to combine SCRCOPY with CAPTUREBLT  ($4000000) like so: SRCCOPY or CAPTUREBLT in order to "see" such forms in my screenshot.
 BitBlt(DestBitmap.Canvas.Handle, 0, 0, DestBitmap.Width, DestBitmap.Height, DC, ox, oy, SRCCOPY or CAPTUREBLT);
(That sees forms with TransparentColor=True)

However doing that with StretchBlt does not have the same effect:
  StretchBlt(Canvas.Handle, 0, 0, Width, Height, FDC,
    P.X, P.Y, SrcWidth, SrcHeight, SRCCOPY or CAPTUREBLT);
Does not see forms with TransparentColor = true.

Any suggestions on how to make that work?  Wheat I need to be able to do is see the portion of the form or of an image on the form that is in a color <other> than the defined transparent color.

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Did you try with SRCCAND?
DMTrumpAuthor Commented:
I assume you meant SRCAND?  Yes I had tried it - just gor a black image.
SRCCAND is not recognized.
DMTrumpAuthor Commented:
I have solved the problem!  
I first do a BitBlt to a from the Desktop to a Bitmap using the SRCCOPY or CAPTUREBLT values then
do a StretchBlt from the intermediate Bitmap to the final canvas.  

That works great.  I haven't timed it but it does not seem to cause any noticeable lag in performance on my rather slow test machine.

Here's the code:

// declare the intermediate bitmap
  XB: TBitmap;

// in the onCreate....

// In a timer handler
// where Zoom is the magnification factor
// and Width and Height are the dimensions of the target bitmap to show the stretched image
// PX is the upper left corner of the source
// FDC is GetDC(GetDesktopWindow);

SrcWidth := Width div Zoom;
SrcHeight:= Height div Zoom;

  BitBlt(XB.Canvas.Handle, 0, 0, XB.Width, XB.Height, FDC, P.X, P.Y, SRCCOPY or CAPTUREBLT);

  StretchBlt(Canvas.Handle, 0, 0, Width, Height, XB.Canvas.Handle,
    0, 0, SrcWidth, SrcHeight, SRCCOPY);

// In ondestroy


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
DMTrumpAuthor Commented:
I'd still be glad to here a better solution than the one I arrived at and will award the remaining 450 points for it  Meanwhile, if anyone arrives here looking for a solution to the problem I posed - my method DOES work <BG>
DMTrumpAuthor Commented:
I gave 50 points to jimyX for at least trying to help - even though I figured out an acceptable solution on my own.
My solution may not be the only one or the best one but it works.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.