Solved

Why my program causes the computer hang up when the display color is 16 colors?

Posted on 2001-07-17
6
136 Views
Last Modified: 2010-04-06
Hi all,
Why my program causes the computer hang up when the display color is 16 colors?

When I run the Delphi 3.0 cs (have all the patches), then load my project, the computer also will hang up.

Not have problem in 256 colors, 16 bit colors and more colors.

Thanks, supwang
0
Comment
Question by:SupWang
  • 4
  • 2
6 Comments
 
LVL 20

Expert Comment

by:Madshi
ID: 6291339
Hi SupWang...   :-)

Please make sure that you have the latest official driver version of your graphics card installed (no beta drivers). This could be a graphics driver problem. Or does the problem also occur on other people's PCs in 16 colors? In that case it has to be the guilt of your program. Then it will be more difficult to solve the problem...

Regards, Madshi.
0
 
LVL 2

Author Comment

by:SupWang
ID: 6292059
Hi Madshi,
How are you? How about you and your girl friend?

Yes, other people's PCs also have the same problem.
when use the stand vga driver(16 colors), also have the same problem. Why the Delphi open this project will cause the computer hang up??

Regards, supwang
0
 
LVL 2

Author Comment

by:SupWang
ID: 6292280
Hi Madshi,
I find that is the delphi bug. the dbgrid will cause this problem. In 16 colors, I create a new project, then drop down a dbgrid to the form, the computer hang up immediately.  :-(

and I try to do the same test in Delphi4, but In 16 colors the D4 can't run and hang up the computer, like my program.

Regards, supwang
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 2

Author Comment

by:SupWang
ID: 6292379
Hi Madshi,
I want to add the following codes to the DPR file. Could you please check it? and I will give the points to you.


var
  tHDC: hdc;
  NumberColors: Integer;

begin
  tHDC := GetDC(0);
  try
    NumberColors := GetDeviceCaps(tHDC, 12) * GetDeviceCaps(tHDC, 14);
  finally
    ReleaseDC(0, tHDC);
  end;
  if NumberColors < 8 then
  begin
    showmessage('This program must run at 256 or more colors.')
  end
  else
  begin
    //do something...
    //do something...
  end;
end;
0
 
LVL 20

Accepted Solution

by:
Madshi earned 50 total points
ID: 6293047
Hi SupWang!

>> How are you? How about you and your girl friend?

Oh well, still the same as every year. Am still working on the "girl friend" project...  :-)

>> I find that is the delphi bug. the dbgrid will cause this problem.

:-(  That's quite sad, really.

>> I want to add the following codes to the DPR file. Could you please check it?

Yep, that's a solution. I'm using such a color depth check in some of my projects, too. My code looks quite the same as your code, but I like named constants more than those "12" and "14", because there nobody knows what they mean:

function GetColorDepth : integer;
var dc : dword;
begin
  dc := CreateCompatibleDC(0);
  try
    result := GetDeviceCaps(dc, BitsPixel) * GetDeviceCaps(dc, Planes);
  finally DeleteDC(dc) end;
end;

Regards, Madshi.
0
 
LVL 2

Author Comment

by:SupWang
ID: 6294021
Hi Madshi,
Your project always very well.  :-)

Thanks, supwang
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
problem when i try to pack my dll file with upx 9 71
How to use Hashing sha1 in Delphi 2010 4 199
Internet Explorer View Settings Question 15 105
oracle global variables 4 63
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…
A short film showing how OnPage and Connectwise integration works.

914 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now