Solved

Windows Colours

Posted on 2000-05-11
5
218 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
[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
  • 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

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!

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…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

756 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