dcsimg
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Page 3 of 5 FirstFirst 12345 LastLast
Results 31 to 45 of 73

Thread: [RESOLVED] Monitor Brightness

  1. #31
    Join Date
    Jun 2004
    Location
    NH
    Posts
    678

    Re: Monitor Temperature

    Try it now with the CopyMem API declared with short int, and the other int short. It works either way, but now its compatible with option strict and explicit.

  2. #32
    Join Date
    Oct 2005
    Posts
    158

    Re: Monitor Temperature

    I don't get a squiggly line, though when I step through and get to that line, the program stops.

  3. #33
    Join Date
    Jul 2001
    Location
    Sunny South Africa
    Posts
    11,268

    Re: Monitor Temperature

    Thanx for all your work!

    No errors now, but it doesn't restore the brightness - I think my PC is just trying to be spiteful LOL!

    I am attaching the sample here ( this is the sample for stin ), and as you'll see, it doesn't retore the brighness levels

    So, it's basically at the same point as what I was with post #21

    This thing is driving me nuts!
    Attached Files Attached Files
    [SIGPIC][/SIGPIC]
    All my Articles
    Hannes

  4. #34
    Join Date
    Jul 2001
    Location
    Sunny South Africa
    Posts
    11,268

    Re: Monitor Temperature

    I am using VB 2010 can that be the problem then??
    [SIGPIC][/SIGPIC]
    All my Articles
    Hannes

  5. #35
    Join Date
    Oct 2005
    Posts
    158

    Re: Monitor Temperature

    That did it. I ran it, but didn't see a change in brightness.

    Now come this questions, so I can understand how this is working.
    Is RAMP1 set to the current gamma when the form loads?
    RAMP2 is then supposed to be a change from RAMP1 (darker)?
    Stepping though I see that lVal is always 0, so it RAMP2's values will always be 0

  6. #36
    Join Date
    Jun 2004
    Location
    NH
    Posts
    678

    Re: Monitor Temperature

    Hey Hannes, are you doing that in the closing event of the form?
    If so, then try to e.cancel=true, if e.windowsshutdown is not true.
    Then also environment.exit(0) after to manually exit the cancelled exit.

    If the api are declared the same I think it will work, unless you do have a stubborn monitor ofcourse. lol

  7. #37
    Join Date
    Jun 2004
    Location
    NH
    Posts
    678

    Re: Monitor Temperature

    I am using 2005. In my opinion the best version yet.

    This example works on all three machines here, one of them a laptop.
    Try it in a new project maybe.

    It could be a permissions issue, escpecially if using Shared.
    Also try it running as admin, well ofcourse.

  8. #38
    Join Date
    Oct 2005
    Posts
    158

    Re: Monitor Temperature

    Ramp1 isn't getting any values, all 0s

    Using VS 2008, btw.

  9. #39
    Join Date
    Jul 2001
    Location
    Sunny South Africa
    Posts
    11,268

    Re: Monitor Temperature

    Quote Originally Posted by stin View Post
    That did it. I ran it, but didn't see a change in brightness.

    Now come this questions, so I can understand how this is working.
    Is RAMP1 set to the current gamma when the form loads?
    RAMP2 is then supposed to be a change from RAMP1 (darker)?
    Stepping though I see that lVal is always 0, so it RAMP2's values will always be 0
    Ramp1(0,0) is supposed to store the current gamma settings
    Ramp2 is supposed to be the changed value

    My Ramp1 is also all 0's ( even with my previous example ), so I still think the whole problem is that the initial call to GetDeviceGammaRamp doesn't somehow succeed in storing the actual values inside Ramp1.

    Quote Originally Posted by TT(n) View Post
    Hey Hannes, are you doing that in the closing event of the form?
    If so, then try to e.cancel=true, if e.windowsshutdown is not true.
    Then also environment.exit(0) after to manually exit the cancelled exit.

    If the api are declared the same I think it will work, unless you do have a stubborn monitor ofcourse. lol
    Initially I did use the Closing event, but changed over to Closed.

    I really do think my monitor is as stubborn as me, afterall, I feel like I'm the monitor's dad LOL! simple thing
    [SIGPIC][/SIGPIC]
    All my Articles
    Hannes

  10. #40
    Join Date
    Jun 2004
    Location
    NH
    Posts
    678

    Re: Monitor Temperature

    Okay well make sure you got drivers that support it first, I guess.

    I just tested this on Windows 7 and promtly crashed each time on
    GetDeviceGammaRamp API.

    MSDN list both API with this:
    Direct color display modes do not use color lookup tables and are usually 16, 24, or 32 bit. Not all direct color video boards support loadable gamma ramps. GetDeviceGammaRamp succeeds only for devices with drivers that support downloadable gamma ramps in hardware

  11. #41
    Join Date
    Oct 2005
    Posts
    158

    Re: Monitor Temperature

    Crazy stuff. Both machines that I've test this on have been 64-bit (one win 7 the other Vista), and neither work. I'll have to test this out later on my 32-bit vista.

  12. #42
    Join Date
    Jun 2004
    Location
    NH
    Posts
    678

    Re: Monitor Temperature

    Hold on a minute, that's weird, well not really... but Windows 7 does run the vb6 example perfectly.

    So perhaps the solution is to use vb6, if it works well without driver support on your machine. That is a possibility.

    If you do want to try the vb6 execute, I could send it to you, or Hannes can compile it as well and test it.

  13. #43
    Join Date
    Oct 2005
    Posts
    158

    Re: Monitor Temperature

    This is such a minor detail that rewritting in 6 just so I can grab the inital ramp just doesn't seem like it makes much sense. Using a value of 14 as the 'default' looks like it works just fine. The target audience of the program is tech savvy enough that they would notice a difference if it should be 14, 12 or 18 even.

  14. #44
    Join Date
    Jun 2004
    Location
    NH
    Posts
    678

    Re: Monitor Temperature

    I bet the behavior vairies on different machines due to driver/component performance. If it does work on others, then you may want to write the code so that it tries, and upon failure set a default.

    EDIT:
    Or confirm the VB6 example works without driver support, and if so, then compile the executable.
    Then automate it with your existing vb.net program, if you've already written alot of other stuff and don't wan to abandon it.
    Last edited by TT(n); June 23rd, 2010 at 12:15 PM.

  15. #45
    Join Date
    Oct 2005
    Posts
    158

    Re: Monitor Temperature

    I agree. I think I'll call this one resolved for good.

    Thank you all for you help with this.
    Last edited by stin; June 23rd, 2010 at 12:11 PM. Reason: Resolved

Page 3 of 5 FirstFirst 12345 LastLast

Posting Permissions

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


Windows Mobile Development Center


Click Here to Expand Forum to Full Width




On-Demand Webinars (sponsored)