?
Solved

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

Posted on 2001-07-17
6
Medium Priority
?
144 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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 200 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
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…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses
Course of the Month14 days, 16 hours left to enroll

770 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