Results 1 to 7 of 7

Thread: Dim the laptop screen.

  1. #1

    Thread Starter
    Frenzied Member longwolf's Avatar
    Join Date
    Oct 2002
    Posts
    1,343

    Dim the laptop screen.

    I have a laptop and will be spending a lot of time running it off a power inverter in my van.
    When the laptop is running on it's own battery the screen dims to use less power.
    But when running off the inverter the screen uses the full brightness.

    Is there some code that will let you set the screen to the lower power setting even when the comp thinks it's running on house current?

  2. #2
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: Dim the laptop screen.

    Is there a particular reason you want to use code?

    You can set it via Control Panel (under "Power Options" I think).

  3. #3

    Thread Starter
    Frenzied Member longwolf's Avatar
    Join Date
    Oct 2002
    Posts
    1,343

    Re: Dim the laptop screen.

    Quote Originally Posted by si_the_geek
    Is there a particular reason you want to use code?

    You can set it via Control Panel (under "Power Options" I think).
    I've looked there, there's only an option to turn off the monitor after x minutes.
    I would like to be able to toggle the dimming of the screen.

  4. #4
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687

    Re: Dim the laptop screen.

    I don't know about you, but my laptop came with hot keys to control that .... what you need to do is set the brightness when it's plugged in... when it becomes unplugged, it'll switch to the "dim" mode... when you plug it back it, it should remember the dimness setting from the last time it was plugged in and restore it.

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  5. #5

    Thread Starter
    Frenzied Member longwolf's Avatar
    Join Date
    Oct 2002
    Posts
    1,343

    Re: Dim the laptop screen.

    Quote Originally Posted by techgnome
    I don't know about you, but my laptop came with hot keys to control that .... what you need to do is set the brightness when it's plugged in... when it becomes unplugged, it'll switch to the "dim" mode... when you plug it back it, it should remember the dimness setting from the last time it was plugged in and restore it.

    -tg
    I hadn't thought of that one, there are function keys for setting the screen brightness.

    Thanks for the help!


    I'm leaving this open for now, it still could be handy to have code for doing it.

  6. #6
    Discovering Life Siddharth Rout's Avatar
    Join Date
    Feb 2005
    Location
    Mumbai, India
    Posts
    12,001

    Re: Dim the laptop screen.

    You can do it using sendmessage. here is an example

    something like this... needs little bit of tweaking. this code puts the monitor off...

    Code:
    Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" _
    (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, _
    lParam As Any) As Long
    
    Private Const SC_MONITORPOWER = &HF170&
    Private Const WM_SYSCOMMAND = &H112
    
    Private Sub Command1_Click()
       Call SendMessage(Me.hWnd, WM_SYSCOMMAND, SC_MONITORPOWER, ByVal 2&)
    End Sub
    Last edited by Siddharth Rout; Mar 10th, 2009 at 03:23 AM.
    A good exercise for the Heart is to bend down and help another up...
    Please Mark your Thread "Resolved", if the query is solved


    MyGear:
    ★ CPU ★ Ryzen 5 5800X
    ★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
    ★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
    ★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
    ★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
    ★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
    ★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
    ★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
    ★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
    ★ Keyboard ★ TVS Electronics Gold Keyboard
    ★ Mouse ★ Logitech G502 Hero

  7. #7
    Hyperactive Member deathfxu's Avatar
    Join Date
    Mar 2009
    Location
    USA
    Posts
    279

    Re: Dim the laptop screen.

    Nice Koolsid, as usual.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width