jaberwacky Posted September 6, 2013 Posted September 6, 2013 (edited) I found these functions on MSDN which control various aspects of monitors such as brightness, contrast, color temperature, etc. This works on my monitors on Windows7 x64. Your mileage may vary. Doesn't work on anything lower than Windows Vista. Not all monitors are supported.Requires the latest AutoIt3 beta.[10-17-2013] -- The VCPs described in the MCCS standard are now wrapped up into Monitor Configuration Wrapper.au3. BE CAREFUL WITH THESE! I made this UDF without any real understanding of why. I do not foresee myself using these, but I put them out here in case someone else does. These functions are all untested. I leave it up to you to decide if the functions that you want to use have been implemented correctly. If you bork your monitor, then go out and buy yourself something really nice.Here are the required au3 files: Monitor Configuration.zipprevious: 52The list of files in the UDF: Monitor Configuration Wrapper.au3 -- This wraps up the MCCS standard into a UDF. Deprecates Low Level.au3. Beware. Example High Level.au3 -- Run this example for a simple monitor configuration dashboard. Monitor Configuration High Level.au3 Monitor Configuration Low Level.au3 -- Deprecated. Monitor Configuration Constants.au3 Monitor Configuration.au3 -- Internal, do not use.What's that? You want to turn off your monitor programmatically?#include "Monitor Configuration Wrapper.au3" Global Const $physical_monitor = GetPhysicalMonitorsFromHMonitor(_WinAPI_EnumDisplayMonitors()[1][0]) PowerMode($physical_monitor, $POWER_OFF) Edited July 20, 2015 by jaberwacky wrong info Bluesmaster and Biatu 2 Helpful Posts and Websites: AutoIt3 Variables and Function Parameters MHz | AutoIt Wiki | Using the GUIToolTip UDF BrewManNH | Can't find what you're looking for on the Forum?
jaberwacky Posted September 6, 2013 Author Posted September 6, 2013 OK, now the low level functions are available. Be careful with these. Use them only if you understand what you're doing. Helpful Posts and Websites: AutoIt3 Variables and Function Parameters MHz | AutoIt Wiki | Using the GUIToolTip UDF BrewManNH | Can't find what you're looking for on the Forum?
tonycst Posted October 11, 2013 Posted October 11, 2013 not one script works for me line 10 return @error unable to parse the line
BrewManNH Posted October 11, 2013 Posted October 11, 2013 Read the first post again, it requires the beta version of AutoIt.. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator
Developers Jos Posted October 11, 2013 Developers Posted October 11, 2013 AutoIt Version: 3.3.8.1 still doesnt work That is not the latest beta. SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
jaberwacky Posted October 17, 2013 Author Posted October 17, 2013 Latest update. See op for more details. Be sure to read the post thoroughly if you plan to use these. Helpful Posts and Websites: AutoIt3 Variables and Function Parameters MHz | AutoIt Wiki | Using the GUIToolTip UDF BrewManNH | Can't find what you're looking for on the Forum?
Bluesmaster Posted January 1, 2015 Posted January 1, 2015 Can I receive the (hardware-)serial of the monitor providing a HMonitor (from "_WinAPI_GetMonitorInfo" etc...) Thank you Bluesmaster My UDF: [topic='156155']_shellExecuteHidden[/topic]
jaberwacky Posted January 2, 2015 Author Posted January 2, 2015 (edited) Well, there are several problems with this UDF. Not surprising considering that I just did this to be able put out a UDF where I did not see one before, without a 100% understanding of monitor technology. I did download and follow the standard though. Hopefully someone can build on this and make it work correct. You may be able to do what you ask. I don't know if the function I coded is coded proper or not. Have you gave it a try yet? Also, which function is it that provides this serial? Edit: the function (I believe) is: EDIDOperation. Edit Again: In case you want to try the original function and this new version: Func EDIDOperation(Const $physical_monitor, Const $block_number) Local Const $return = SetVCPFeature($physical_monitor, 0x78, $block_number) Return (@error ? SetError(1, @extended, False) : $return) EndFunc Edited January 2, 2015 by jaberwacky Helpful Posts and Websites: AutoIt3 Variables and Function Parameters MHz | AutoIt Wiki | Using the GUIToolTip UDF BrewManNH | Can't find what you're looking for on the Forum?
Bluesmaster Posted January 2, 2015 Posted January 2, 2015 Hi jaberwacky, At the beginning of my research I saw your UDF, I didnt work so 2-day journey of research followed. I was on WMI > "WmiMonitorID" which can read the serial but cannot associate it with a monitor number (this was hard to swallow) Now I took a deeper look into your UDF again. It the capabilities are amazing...but: GetNumberOfPhysicalMonitorsFromHMonitor() fails. Argh...it returns 0 for all handles. And throws no errors. I thought it might be a problem in your implementation so I tried implementations in other programming languages but all the same. ( I am on Win8.1x64 autoit v3.3.10.0 ) It might have something to do with my Monitor Configuration (DisplayPort > Adapters > Monitor) But on the other hand I found a c# project which can successfully save my monitor configuration using the dxva2: http://sourceforge.net/projects/monitorswitcher/ Do you have any idea what we can debug here to find the root of the problem? best regards Bluesmaster My UDF: [topic='156155']_shellExecuteHidden[/topic]
MikahS Posted January 2, 2015 Posted January 2, 2015 Could have something to do with OP's first post. Edit: I found some issues with this UDF. Please do not use it. this might be the issue you are talking about? Snips & Scripts My Snips: graphCPUTemp ~ getENVvarsMy Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4 Feel free to use any of my code for your own use. Forum FAQ
Bluesmaster Posted January 2, 2015 Posted January 2, 2015 @ Community Can some of the community test the following code quickly and post the results? I would like to know if it is a specific problem to my computer configuration #include <WinAPIGdi.au3> $physical_monitor = DllStructCreate("handle physicalMonitor;wchar physicalMonitorDescription[128]") DllCall( "Dxva2.dll" , "bool", "GetPhysicalMonitorsFromHMONITOR", "handle", _WinAPI_EnumDisplayMonitors()[1][0], "dword", 1, "ptr", DllStructGetPtr( $physical_monitor ) ) ConsoleWrite( @OSVersion & @OSArch & @LF & DllStructGetData($physical_monitor, "physicalMonitor") & @LF & DllStructGetData($physical_monitor, "physicalMonitorDescription") & @LF ) @ jaberwacky I used the "EDIDOperation". ...ok It reads the EDID-Block ( 12-15 = monitor serial number > http://en.wikipedia.org/wiki/Extended_display_identification_data ) But it only tells me that it succeded...now where is the data ? I know you are not an monitor expert...but honestly...who else should know if not you If we solve the problem we can also answer this thread: '?do=embed' frameborder='0' data-embedContent>> btw i recommend linking this in the op: http://msdn.microsoft.com/en-us/library/windows/desktop/dd692964(v=vs.85).aspx ( as I had my problems figuring out which api you are using firstly ) My UDF: [topic='156155']_shellExecuteHidden[/topic]
jaberwacky Posted January 2, 2015 Author Posted January 2, 2015 (edited) GetNumberOfPhysicalMonitorsFromHMonitor() fails. Argh...it returns 0 for all handles. And throws no errors. I thought it might be a problem in your implementation so I tried implementations in other programming languages but all the same. ( I am on Win8.1x64 autoit v3.3.10.0 ) Did you run this example in the OP? #include "Monitor Configuration Wrapper.au3" Global Const $physical_monitor = GetPhysicalMonitorsFromHMonitor(_WinAPI_EnumDisplayMonitors()[1][0]) PowerMode($physical_monitor, $POWER_OFF) It works for me. Edited January 2, 2015 by jaberwacky Helpful Posts and Websites: AutoIt3 Variables and Function Parameters MHz | AutoIt Wiki | Using the GUIToolTip UDF BrewManNH | Can't find what you're looking for on the Forum?
jaberwacky Posted January 3, 2015 Author Posted January 3, 2015 Could have something to do with OP's first post. this might be the issue you are talking about? Actually, you're spot on. This is the exact reason that I put that disclaimer up there. But I figure that nothing catastrophic could result so I left it available. Helpful Posts and Websites: AutoIt3 Variables and Function Parameters MHz | AutoIt Wiki | Using the GUIToolTip UDF BrewManNH | Can't find what you're looking for on the Forum?
jaberwacky Posted January 3, 2015 Author Posted January 3, 2015 (edited) I don't really know. Some forum posts seem to indicate that it can't be read this easily. But it seems that Windows can read it because it stores the EDID in the registry. So, I tried: Func EDIDOperation(Const $physical_monitor) Local Const $return = GetVCPFeatureAndVCPFeatureReply($physical_monitor, 0x78) Return (@error ? SetError(1, @extended, False) : $return) EndFunc ConsoleWrite(EDIDOperation($physical_monitor)[0] & @CRLF) To no avail. If the standard says that 78h is the VCP then I can't just say 0x78 can I? I have to convert it from hex to decimal, so 120? I tried it but I don't know if this is the reason it won't work or some other reason. Answered my own question. I follow the 0x convention in the example in the OP and that works fine so I assume I can just turn the h into a 0x. Edited January 3, 2015 by jaberwacky Helpful Posts and Websites: AutoIt3 Variables and Function Parameters MHz | AutoIt Wiki | Using the GUIToolTip UDF BrewManNH | Can't find what you're looking for on the Forum?
Bluesmaster Posted January 3, 2015 Posted January 3, 2015 (edited) 1. OP example didnt work because GetPhysicalMonitorsFromHMonitor didnt work. (I thought but I tried with manual monitorNumbers "1", "2"...which is what GetPhysicalMonitorsFromHMonitor returns???) 2. 78h means 78hex means 0x78 3. You changed EDIDOperation to from GetVCPFeature in to GetVCPFeatureAndVCPFeatureReply which is better but for me returns [ 0 0 0 ] for any blocks and any monitorNumbers (and for you???) *found a small mistake in your GetVCPFeatureAndVCPFeatureReply > it returns [ $VCPCodeType $CurrentValue $CurrentValue ] instead of [ $VCPCodeType $CurrentValue $MaximumValue ] 4. Its no problem to read the EDID from registry but they are not in PhysicalMonitorNumber-order so I cannot correlate them to my monitors, which I intend 5. I tried it in virtual machine, doesnt work either. I think I will give up for the moment, which is very hard after so much time spend Edited January 3, 2015 by Bluesmaster My UDF: [topic='156155']_shellExecuteHidden[/topic]
Bluesmaster Posted January 3, 2015 Posted January 3, 2015 what I forgot to mention is that GetPhysicalMonitorsFromHMonitor delivers the monitor name ( 2. DllStruct Entry ) which indicates that it is working somehow.. My UDF: [topic='156155']_shellExecuteHidden[/topic]
jaberwacky Posted January 5, 2015 Author Posted January 5, 2015 Run this code please: #include "Monitor Configuration Wrapper.au3" Const $h_monitor = _WinAPI_EnumDisplayMonitors()[1][0] Const $_physical_monitor = GetPhysicalMonitorsFromHMonitor($h_monitor) ConsoleWrite(GetMonitorCapabilities($_physical_monitor) & @CRLF) If it returns 0 then your monitor doesn't support these functions. Helpful Posts and Websites: AutoIt3 Variables and Function Parameters MHz | AutoIt Wiki | Using the GUIToolTip UDF BrewManNH | Can't find what you're looking for on the Forum?
Bluesmaster Posted January 5, 2015 Posted January 5, 2015 Hi, It returns 0. But that might be because of GetPhysicalMonitorsFromHMonitor returns 0 before. Also the c#-Project I meantioned (http://sourceforge.net/projects/monitorswitcher/) does use the same API with success. And I have several ( 7 ) very modern LED-Monitors which must support this standards. However, Monitorconfiguration is a very complex topic, and it might have somethink to do with my computer config. Anyway I dont die without these functions, and for everyone else this is great work done here and I could highly recommend this powerful udf. I just fear, your "I code the 0.9-version and anyone else will pick up and maintain it" is a bit illusive, and I would encourage you to take the main responsibility for the udf. But thats just my opinion (in bad english ) thank you & best regards Bluesmaster My UDF: [topic='156155']_shellExecuteHidden[/topic]
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now