Advertisement

08.07.2008 at 01:59PM PDT, ID: 23631004
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

7.2

Delphi 7: After many BitBlts to bitmap it doesn't change anymore

Asked by JackJohnsons in Delphi Programming Language, Delphi Programming, Graphics and Delphi Programming

Tags: , , , , , ,

Hello experts

I wrote a function to find a color on the screen, it uses bitblt then directly accesses the bitmap in memory. it works fine, but when I call the function in a burst (for i := 0 to 10000 i.e.) the bitmap "hangs". When the screen changes the bitmap doesnt change anymore =/ It's certainly not the way of accessing the bitmap because when I draw the bitmap to another canvas, it reflects the old screen.
Anyone who got an idea why?Start Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
unit ColourFinder;
 
{$O+}
 
interface
 
uses Windows, Variants, Graphics, Sysutils, Forms;
 
type
  TRGB24 = packed Record
    b,g,r: Byte;
  end;
 
  TRGB24Array = Array [0..MaxInt div SizeOf(TRGB24)-1] of TRGB24;
  PRGB24Array = ^TRGB24Array;
 
var
  SBMP : TBitmap; //Search bitmap
  Scanlines: Array of PRGB24Array; //scanlines
  I: Integer; //for for loop for getting the scanlines
 
function FindColor(var x, y: Integer; color, xs, ys, xe, ye: Integer; ClientDC : HDC): Boolean;
 
implementation
 
function FindColor(var x, y: Integer; color, xs, ys, xe, ye: Integer; ClientDC : HDC): Boolean;
var
  xx, yy: Integer;
  R, G, B: Byte;
begin
 
  R:= color;
  G:= color shr 8;
  B:= color shr 16;
 
  BitBlt(SBMP.Canvas.Handle, xs, ys, xe - xs, ye - ys, ClientDC, xs, ys, SRCCOPY);
 
  for yy:= ys to ye do
    for xx:= xs to xe do
      if(Scanlines[yy][xx].R = R)then if(Scanlines[yy][xx].G = G)then if(Scanlines[yy][xx].B = B)then
      begin
        x:= xx;
        y:= yy;
        Result:= True;
        exit;
      end;
  Result:= False;
  x:= -1;
  y:= -1;
end;
 
initialization
  SBMP := TBitmap.Create; //Create the search bitmap
  SBMP.Width:= Screen.Width;
  SBMP.Height:= Screen.Height;
  SetLength(Scanlines, SBMP.Height);
  SBMP.PixelFormat:= pf24bit;
  for I:= 0 to SBMP.Height - 1 do
    Scanlines[i]:= SBMP.ScanLine[i];
  ClientDC := GetDC(0);
end.
 
Keywords: Delphi 7: After many BitBlts to bitmap…
 
Loading Advertisement...
 
[+][-]08.08.2008 at 07:04AM PDT, ID: 22189957

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08.08.2008 at 07:09AM PDT, ID: 22190007

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08.10.2008 at 02:09AM PDT, ID: 22199121

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]08.11.2008 at 01:01AM PDT, ID: 22202461

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08.13.2008 at 02:38AM PDT, ID: 22220245

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]08.13.2008 at 05:33AM PDT, ID: 22221090

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08.15.2008 at 11:04AM PDT, ID: 22240349

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08.23.2008 at 02:29PM PDT, ID: 22298541

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]08.24.2008 at 01:14AM PDT, ID: 22299940

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08.24.2008 at 01:15AM PDT, ID: 22299942

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08.24.2008 at 04:19AM PDT, ID: 22300196

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08.24.2008 at 04:27AM PDT, ID: 22300208

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Delphi Programming Language, Delphi Programming, Graphics and Delphi Programming
Tags: Borland, Delphi, 7, self-made program, Borland Delphi 7, -, -
Sign Up Now!
Solution Provided By: BdLm
Participating Experts: 1
Solution Grade: A
 
 
[+][-]10.27.2008 at 06:37AM PDT, ID: 22812477

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 7-day free trial to view this Administrative Comment or ask the Experts your question.

 
[+][-]11.01.2008 at 08:28PM PDT, ID: 22859992

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 7-day free trial to view this Administrative Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628