Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Programically Changing the Color Depth of the monitor

Programically Changing the Color Depth of the monitor

Scheduled Pinned Locked Moved Visual Basic
csharpdotnethelp
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    Darshon
    wrote on last edited by
    #1

    Hi, I'm trying to change the color depth of the user's monitor upon my app starting. I can't seem to find anything on the subject. I'm coding in 1.1 VB.Net framework. Any help would be great. Thanks

    D L 2 Replies Last reply
    0
    • D Darshon

      Hi, I'm trying to change the color depth of the user's monitor upon my app starting. I can't seem to find anything on the subject. I'm coding in 1.1 VB.Net framework. Any help would be great. Thanks

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #2

      First, your app, since it's running on a shared system with other applications, should NEVER change system-wide settings like this. Second, why do you want to do this?

      A guide to posting questions on CodeProject[^]
      Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
           2006, 2007

      1 Reply Last reply
      0
      • D Darshon

        Hi, I'm trying to change the color depth of the user's monitor upon my app starting. I can't seem to find anything on the subject. I'm coding in 1.1 VB.Net framework. Any help would be great. Thanks

        L Offline
        L Offline
        Luc Pattyn
        wrote on last edited by
        #3

        If you want to persist anyway, get prepared for some P/Invoking. There isnt a function SetDisplayColorDepth() or so; instead you need access to the following Win32 functions (below is C# syntax):

        [DllImport("user32.dll")]
        public static extern int EnumDisplaySettings (string deviceName,
        int modeNum, ref DEVMODE1 devMode );

        [DllImport("user32.dll")]
        public static extern int ChangeDisplaySettings(ref DEVMODE1 devMode, int flags);

        for which you also would need a number of constants and the DEVMODE1 struct; then add some C# or VB code to obtain the supported settings, find the one you want, and set it. If you havent done P/Invoke before, dont bother. Try something simpler first. :)

        Luc Pattyn


        try { [Search CP Articles] [Search CP Forums] [Forum Guidelines] [My Articles] } catch { [Google] }


        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups