Solved

Windows Colours

Posted on 2000-05-11
5
215 Views
Last Modified: 2010-04-04
Hi guys

How do you force Windows to display 16Bit or True Colour, and then also to change it back.
(Got code to change the Resolution but need code for changing the colour too).

Thankx
0
Comment
Question by:PieterJ
  • 2
  • 2
5 Comments
 
LVL 6

Expert Comment

by:edey
Comment Utility
from win32.hlp:

The ChangeDisplaySettings function changes the display settings to the specified graphics mode.

LONG ChangeDisplaySettings(

    LPDEVMODE  lpDevMode,      
    DWORD  dwflags      
   );


GL
Mike
0
 
LVL 3

Expert Comment

by:shenqw
Comment Utility
before ChangeDisplaySettings , your maybe do this:

BOOL EnumDisplaySettings(

    LPCTSTR lpszDeviceName,      // specifies the display device
    DWORD iModeNum,      // specifies the graphics mode
    LPDEVMODE lpDevMode      // points to structure to receive settings
   );      
 

Good Luck!

shenqw
0
 

Author Comment

by:PieterJ
Comment Utility
Thanks Mike and Shenqw,
have you guys got an example eg. changing colours from 16Bit to 256 Colours or whatever?
Thankx again !
0
 
LVL 3

Accepted Solution

by:
shenqw earned 50 total points
Comment Utility
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls;

type
  TForm1 = class(TForm)
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.Button1Click(Sender: TObject);
  procedure NewScreenSize(W,H: Integer);
  var
    DevMode: TDevMode;
  begin
    if EnumDisplaySettings(nil,0,DevMode) then
    begin
      with DevMode do begin
        dmPelsWidth := W;
        dmPelsHeight := H;
        dmBitsPerPel:=16;  
        dmFields := DM_PELSWIDTH or DM_PELSHEIGHT or DM_BITSPERPEL;
      end;
      ChangeDisplaySettings(DevMode, 0);
    end;
  end;

begin
  NewScreenSize(800,600);
end;

end.



dmBitsPerPel

Specifies the color resolution, in bits per pixel, of the display device (for example: 4 bits for 16 colors, 8 bits for 256 colors, or 16 bits for 65536 colors). Display drivers use this member, for example, in the ChangeDisplaySettings function. Printer drivers do not use this member.
0
 

Author Comment

by:PieterJ
Comment Utility
Thanx a lot !!
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Suggested Solutions

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…
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…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

771 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

10 Experts available now in Live!

Get 1:1 Help Now