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.
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
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
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.
Originally Posted by TT(n)
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
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
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.
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.
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.
* The Best Reasons to Target Windows 8
Learn some of the best reasons why you should seriously consider bringing your Android mobile development expertise to bear on the Windows 8 platform.