How to change 3rd monitor programmatically - windows

When I'm using my laptop, I use 3 displays:
The laptop display
A second monitor (connected through VGA)
A TV (connected through HDMI)
My videocard doesn't support 3 monitors, so I'm constantly switching from 2 to 3: when I'm on the computer, I use the 2nd monitor, and when I want to watch some movies, etc. I use the 3rd.
I currently have to go to Screen Resolution, select the monitor that is not in use, and choose Extend desktop to this display.
Is there a way I can automate it?
Is there any command-line tool, or any Windows API that allows doing it?
Edit:
Display Changer seems to do what I need, but the problem is that it only detects the working monitors. The 3rd monitor (which isn't currently in use) isn't detected, so I can't attach it.

A bit of RE on DisplaySwitch.exe shows that it calls
SetDisplayConfig(0, NULL, NULL, NULL, 0x888)
to set it to Extended on my computer.
From there, a little digging around got me to the SetDisplayConfig documentation obviously and also this SO page with some example code that queries your current display state and adds the actual flags to change them if you want to do so.

I answered a similar question with suggestion to try UltraMon or use their SDK, but you can also hit the Win32 API directly with ChangeDisplaySettingsEx. Another user, Sai, gave an reference to an example showing use of the function.

Related

Prevent disconnected display from merging windows into the active one

I've got a personal laptop (running Windows 10) which I use at work where I connect it to an external display using extended display mode. I keep all my personal icons and windows on my laptop display and store all the work-related windows on the external display. Whenever I unplug it, all the windows and icons from that display are merged into my laptop screen. I want to programmatically prevent changing anything on my primary screen when the secondary is disconnected. I'm currently writing a utility app for a variety of small productivity improving features and would like to add such feature in it. I can think of two ways to achieve this:
by tricking the system to think that the external display hasn't been
disconnected;
or take all the opened windows and icons on disconnected screen and put them on separate virtual desktop.
I was looking into Windows GDI Device Context Functions but haven't found anything about display connection/disconnection events. How can I detect display disconnection (and get that display's opened windows and icons)? Anything that can be done using C#, C++ or PowerShell scripts would be much appreciated!

Integrate Windows 8 program with windows search

I want to know if it is possible to have data from my Windows 8 program be able to show up in windows search. For instance, the user could search for "myprogramdata1" in windows and then an item would show up that when clicked would open up my program and I'd be able know that "myprogramdata1" was selected.
EDIT:
I know that it is possible for windows 10. For the program DisplayFusion, if I search settings, there is a result for DisplayFusion settings that can be clicked on and will bring me to the settings page for the program. Does anyone know how this is done?
First of see if you say the command that you typed in using cortana and if it opens settings. If yes, You can absolutely do it.
I did it for one of my app too( Well this was not my intention but it works )
UWP Samples-CortanaVoiceCommand
The key here is once Voice Commands are installed, you can type the text in cortana search (instead of actual voice command) and it works the same. You can still use patterns of voice commands and still type in Cortana search and open your app.

Location Tracking in Background

I am developing a windows phone app that uses users current location, I am making the app in 7 OS. My question is, Can I track the location in background, that is when the screen is locked?
I know this is a possibility in wp8 as it provides us with GeoLocator class, but can I achieve this in wp7? I am basically making a runtracker app hence I would like my app to track the location even when its in background, is it really feasible?
Your help is always appreciated!!
It is possible to keep the app running under lock screen, as it does, for example, Endomondo app.
Using Idle Detection, you can keep the app on, although screen is locked, and you can keep on tracking the location. Actually, it is not running in background, but in the foreground. Just the screen is locked. So, be careful not to drain user's battery.
You have to set the PhoneApplicationService.ApplicationIdleDetectionMode property to Disabled, for example in InitializePhoneApplication() method in App.xaml.cs:
PhoneApplicationService.Current.ApplicationIdleDetectionMode = IdleDetectionMode.Disabled;
Note that there are special certification requirements for this type of apps. Refer to section 6.3 (Apps running under a locked screen) of the following page:
Additional requirements for specific app types for Windows Phone
I got the same problem in one on my apps..
I don't think it' s feasible for wp7..
Bt if you want to do it with wp8 you can refer following link.
http://msdn.microsoft.com/en-us/library/windowsphone/develop/jj681691%28v=vs.105%29.aspx
And to know about background supported and unsupported API's http://msdn.microsoft.com/en-us/library/windowsphone/develop/hh202942%28v=vs.105%29.aspx/css
GeoCoordinateWatcher Class exists in WP7, but here is the documentation from MSDN -
This API, used for obtaining the geographic coordinates of the device,
is supported for use in background agents, but it uses a cached
location value instead of real-time data. The cached location value is
updated by the device every 15 minutes.
More Info : http://msdn.microsoft.com/en-us/library/windowsphone/develop/hh202962%28v=vs.105%29.aspx/css

How to put monitor on standby and not let it wake up

I have 3 monitors, but I don't need them all turned on all the time. I can just shut them down with power button, but I want to use their standby mode, like Windows does when we let PC idle for a while - it shuts down monitors, HDD, etc.
But of course, I wanna keep using PC and let just that monitor on standby. Others must remain on and that one doesn't wake up even with me using PC.
Is it possible to do that? It would be great to have a shortcut like Winkey+1, 2, 3 etc to shut down and wake up each monitor.
An existing app with this feature is not likely to exist, but is there a Windows API function that can control monitor state, for each monitor in a MultiMonitor system?
The display control panel applet calls SetDisplayConfig to start or stop forced projection on a particular target
You can probably use MS Detours or some other API hooking tool to inspect the usage pattern of the API while using the applet to adjust display settings.
You'll want to try Display Fusion. You should be able to do what you're asking for using Monitor configurations.
I know I'm late on this but use DDC to control your display. You can easily create hotkeys that send a command via DDC to the display to turn-off. This would be equivalent to turning off the display using the button. Works like a charm for me. The only trick is that DDC command specs vary across monitor manufacturers but its not hard to find the right codes to send with the help of google.
Ready made tools also exist for this; search for anything that is related to DDC or EDID and you should find.
Be aware though that this does not remove the display from Windows which means that apps may find their way onto displays that are off and you will be looking for them.

Windows 7 Taskbar Widget or Toolbar

My Lenovo laptop has two task bar type programs that show the network status and battery status. I have been trying to search for what these types of widgits are called. Unfortuantly my google-foo is only returning results for minimizing programs to the system tray.
I am not even sure if these are system tray apps or taskbar apps. but either way, please help me find a API reference or even better a tutorial.
I want to make a Work Week Widgit, that displays the current work week number on this widget. I program mostly in python, but am willing to learn another language just to make this tool.
They are known as Desktop Bands, also known as DeskBands. Note that Desktop Bands are not recommended starting in Windows 7. Note also that since they are shell extensions, they must be written in native code.

Resources