Solved

Windows Colours

Posted on 2000-05-11
5
217 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Mydac connection data base issue 3 159
Simple Delphi Question 9 90
Is anyone willing to have a look through this code and help debug? 25 77
Dev express lookupcombo 3 30
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
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…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

825 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