Solved

Windows Colours

Posted on 2000-05-11
5
216 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
ID: 2803249
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
ID: 2803308
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
ID: 2803314
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
ID: 2803392
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
ID: 2803407
Thanx a lot !!
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

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 Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

910 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