Everything is pretty much in the title, I have tested using Display Changer but without success because my monitor are both named "Generic PnP Monitor" so I can't say which screen must be set as the primary. I've seen that i need to download the drivers to get my monitor a name but both of my monitor don't have driver for Windows 10. I would think there must be a way to simply swap the principal screen to the other one or something like that but I haven't seen anyone do it.
Maybe you can try nircmd.exe which is a small but powerful command-line utility .
http://www.nirsoft.net/utils/nircmd.html
setdisplay {monitor:index/name} [width] [height] [color bits] {refresh rate} {-updatereg} {-allusers}
....... You can specify the monitor by index (0 for the first monitor, 1 for the second one, and so on) or by specifying a string in the system monitor name...........
Another solution is to use the multi monitor tool, as it allows for more functionality towards switching monitors, such as moving windows as well. Also has a simpler command for the basic task at hand.
http://www.nirsoft.net/utils/multi_monitor_tool.html
/SetPrimary <Monitor>
Set the primary monitor.
Example:
MultiMonitorTool.exe /SetPrimary 2
Related
I'm writing a small program to save my laptop's battery, and I can now switch between power schemes using PowerSetActiveScheme.
The next step is to control the battery saver in Windows 10. Though I can read the state of it using GetSystemPowerStatus, I can't find a way to enable/disable it programmatically. Are there any functions in Windows API to do this?
Most probably you can do it Linux-way, by calling a system app named PowerCfg through ShellExecuteEx():
powercfg /setdcvalueindex SCHEME_CURRENT SUB_ENERGYSAVER ESBATTTHRESHOLD 100
powercfg /setactive scheme_current
This means that the energy saver is activated even when the battery percentage equals 100%. SUB_ENERGYSAVER and its sub-GUID ESBATTTHRESHOLD are described here.
#hidefromkgb's answer is pretty much correct. The only missing part is that to disable Energy Saver and prevent it from turning it on, you need to do:
powercfg /setdcvalueindex SCHEME_CURRENT SUB_ENERGYSAVER ESBATTTHRESHOLD 0
powercfg /setdcvalueindex SCHEME_CURRENT SUB_ENERGYSAVER ESBRIGHTNESS 100
If you do that, and go back to the control panel Battery Saver section, you will see that the first checkbox is now disabled (although it still shows 20% but it is grayed out so it should be ok). Also the second checkbox (lower screen brightness) will be unchecked.
You seem to be out of luck. MSDN docs show no API through which the battery saver could be controlled. Examining SettingsHandlers_OneCore_BatterySaver shows that only GetSetting is exposed. Even SetPowerState in WMI Win32_Battery is not implemented -- I know this is not exactly what you need, but it shows that Microsoft has not gotten around to exposing the battery-related functionality. At this point, instead of reverse-engineering the button click, your best bet is probably to emulate it with something like AutoHotKey, however beware of the pitfalls with that.
I'm writing a python/C application that uses OpenCL and I'd like to let the user choose his/her favorite OpenCL device to run it on.
This should happen offline, with the preferred device stored in an ini file.
Does anybody have an idea how to do this? The device ids aren't consistent between process calls, so I could store the device names and then perform string matching?
The examples I've seen query the available platforms/devices (clGetAvailablePlatforms/Devices) and put the names in a combo box, then use the "selected index" of the combo box as indication of which device the user wants to use at runtime.
So I'd say let the user select the index of the device as it shows up in clGetAvailablePlatforms/Device. The only problem with this is that if the user is constantly chaginging graphics cards or driver versions, the order can change. Then you need to get the precise device name string (which can also change between driver version - although vendors usually don't do that).
I'm working in a embarked application on linux that can be used with different PC hardware (displays specifically)
This application should set the environment for the highest allowed resolution (get by
the function XRRSizes from libXrandr).
The problem is: With some hardware, trying to set for the highest option creates a virtual desktop i.e. a desktop where the real resolution is smaller and you have to scroll w/ the mouse in the edges of the screen to access all of it.
Is there a way to detect within the Xlib (or one of it's siblings) that I am working with a virtual resolution (In other words, the re-size didn't go as expected) ?
Hints for a work around for this situation would also be appreciated...
Thanks
Read this: http://cgit.freedesktop.org/xorg/proto/randrproto/tree/randrproto.txt
You need to learn the difference between "screen", "output" and "crtc". You need to check the modes available for each of the outputs you want to use, and then properly set the modes you want on the CRTCs, associate the CRTCs with the outputs, and then make the screen size fit the values you set on each output.
Take a look at the xrandr source code for examples: http://cgit.freedesktop.org/xorg/app/xrandr/tree/xrandr.c
I'm creating windows for debugging like this:
cvNamedWindow("a",0); cvShowImage("a", imageA);
cvNamedWindow("b",0); cvShowImage("b", imageB);
cvNamedWindow("c",0); cvShowImage("c", imageC);
OpenCV creates all these windows in the exact same spot, which is not very practical, since only one of them is visible unless you move them around.
Can I make OpenCV automatically arrange the windows so that all of them can be seen (like a tiling window manager)? Or do I have to do this myself using cvMoveWindow?
No, this is impossible - there's no such feature in User Interface (I also was wondering about such functionality a month ago).
You have to manualy set window(s) position by calling MoveWindow - this is the only solution.
I'm in way over my head and looking for a broader understanding of what it would take to feed alternate data into a mouse driver to control the pointer without moving the mouse.
I have modified a driver (untested) to provide random data, but I need to be able to turn on/off the random mouse data and I don't think a simple scanf to ask for a "Do you want to do this?" is going to work. I think that I need to build an interface of some kind that will interact with the driver.
Can anybody give me any perspective on this? I have very little idea of what I need to do.
Thanks,
Shawn Lewis
That depends on if the mouse driver you've modified is in userspace or kernelspace.
If it's userspace, you could use a UNIX-domain socket as your control channel. If it's kernelspace, you could use a sysfs entry.
Probably you can read real data from device but send random junk. When you read a click or some movement you can switch to real mode. If no movement in some timeout you can switch to random again. It all depends what are you trying to accomplish.
uinput can be used to inject input events.
An excellent tutorial about already mentioned uinput: http://thiemonge.org/getting-started-with-uinput