I am developing a virtual desktop application and have been an avid dexpot user for some time. I've been reading the Win32 documentation, specifically the CreateDesktop and SwitchDesktop functions. From what I understand, only one desktop can be viewed at a time, yet dexpot manages to show a real time view of all active desktops in its full screen preview mode. Does anyone know a way of possibly implementing this? My first idea is to rapidly switch desktops, but this would use up far too much processing power.
The most difficult part about what you want to do is application switching. You cannot move an application instance from one Desktop object to another. I would base my implementation off of remote desktop applications. There's plenty of open source clients you can look into for some ideas. I would look into the desktop duplication api as well. One idea that comes to mind is making one large desktop, locking the mouse and view to one particular region, and using desktop duplication to show all the split up regions as separate desktops. That's assuming desktop duplication works as I think it does. I'm not sure as I don't use windows.
Related
I'm attempting to run two applications simultaneously on windows 7, however, I'm finding that when I do this, whichever has focus runs at a normal speed but the other is clearly running at a far slower speed. (For reference, one is a unity application and the other is a C++ direct X application). Has anyone ever encountered something like this? Is there a way to allow both applications to run at full speed? The system ought to have the resources to run both, neither are very complex. When I monitor the system resources, etc, everything looks good.
Windows automatically offers less system resources to unfocused programs no matter their complexity or requirements. I don't believe you can disable that.
That makes sense. I looked into a bit deeper and found that the Desktop Window Manager was the one causing the headache. I stopped the service, set the processor affinity for each application, and everything was golden after that.
I've been looking into dimming a screen on a Windows platform from my program. I know that there's a SetMonitorBrightness API that allows this, but the issue for me is that it would be nice to be able to dim the screen on Windows XP as well (which that API does not support) and also dim screens on desktop computers.
So I did some research and found this utility that seems to dim my screen on a Windows XP desktop without a problem. I tried to contact the author to find out how they implemented the dimmer but I did not hear back from them.
So I was curious to hear from developers on this site, how do you think they managed to dim the screen when the SetMonitorBrightness API is not supported?
PS. I am a newbie developer myself trying to write an energy saving program for our small business. It is a nonprofit organization and we don't have funds to hire a Windows developer to do this for us. Most of our computers are Windows XP desktops, so as you can see I can't use SetMonitorBrightness API as it is widely documented on the web.
Thanks in advance.
In the case that you cite, have a look at the screensaver with Dependancy Walker. My guess is that they create a full screen window and use SetLayeredWindowAttributes() to set a semi-opaque setting for the window, thus making the screen appear dimmed. I doubt it would save you much money.
You might want to look into the DDC protocol which allows you to control aspects of some monitors. The MS API that allows you to do this can be found roundabout here: http://msdn.microsoft.com/en-us/library/windows/hardware/ff570290%28v=vs.85%29.aspx and you should look at the I2C functions too.
Alternatively you could look for a ready made library to do the DDC stuff for you, such as http://www.nicomsoft.com/products/i2c/. They too have a dimmer application that is free for personal use and non-free for commercial use. They may even allow you to use it for free if you contact them and explain it's for a non-profit organisation.
If you are trying to do this as an energy saving program why not use a screensaver setting that turns the monitor off after a certain period of idleness? In any case
Forgive me if this information is outdated, but I have done this in the past using SetDeviceGammaRamp. The 'Get' version is available too for state saving and restore. I have seen it used in C# programs through, so it might still be relevant albeit not too common anymore.
I am building a C++ (Qt) based application for controlling a flash based UI. Because the flash runtime leaks spectatular amounts of memory, we execute the UI as a .swf loaded in the standalone flash player separate from the command-and-control app written i C++.
The C++ starts the flash player as an external process with appropriate parameters, and communicates with it over a TCP socket connected to localhost.
The application runs primarily on Windows XP and above.
The unfortunate side effect of running the flash player standalone is that two applications are shown in the Alt+tab list as well as in the task bar on windows (one being our application, the other being the flash player). Additionally, as the application runs full screen, flash must manage the entire screen. Allowing the C++ app to draw parts of the screen would be a massive improvement.
We would like to somehow merge the two, while leaving our own application in control. I am thinking something along the lines of Google Chrome, which appears to be running each browser tab in a separate process while displaying all output in a single window.
I've been reading up in the Win32 API (and google) in order to determine if accomplishing this is even possible. Althogh so far I've come up with dll injection as the only semi-viable solution, but I would very much like to consider that plan B.
Any suggestions would be appreciated.
The Alt+Tab list shows top-level (no parent) windows that are visible and don't have the WS_EX_TOOLWINDOW extended style. So if you have two windows from two processes but you only want to see one in the Alt-Tab list (and on the task bar), then you have a few options:
Add the WS_EX_TOOLWINDOW to one of the windows.
Re-parent one of the windows to a hidden top-level window.
Re-parent one of the windows (probably the Flash player) to the other window. This is tricky, but it's probably how Chrome and many other multi-process single-window apps work. What makes it tricky is handling the lifetimes of the windows and inadvertently serializing the message queues.
I guess this question and its answers are related to your question:
Embedding Flash Player in a C++ or Java application?
DLL injection won't get you anywhere, the memory would still be allocated in your main process if you're instantiating the flash player as an in-process server.
If you want to keep control over the memory leaks you have to keep the flash player in a seperate process.
Your current approach sounds viable, your only problem seems to be that the process is still visible in something like the Alt+Tab list... as far as i recall, setting the extended window style to WS_EX_TOOLWINDOW should help you with that.
For hiding the process from the taskbar see e.g. here.
In Windows XP the Win32 API renders the controls using GDI/GDI+.
Now I'm on 7, so if I use the API's functions, will the rendering automatically be handled by the DWM/WDDM (so by DirectX)? or will it continue to render with GDI?
Or likewise, will an old app written with WinAPI, be rendered with GDI also in Windows 7?
Thank you in advance for the help :)
In my experience, if the Aero display is on everything will render via that system, it just won't be obvious to your application. You'll still render in GDI, but it will be to a back buffer and not directly to the screen buffer (in fact it's more complicated then that). That way your older app can get the benefits of the new features, like the live preview effects, without having to be aware of them.
Really though, your application doesn't really notice a difference. The API is still the same API as before and works as you expect it. There are ways to take advantage of this, but you have to opt in to really use it.
If your application is written to use GDI, then it will continue to use GDI. The underlying implementation has changed quite a bit (as I recall, most hardware acceleration was removed in Vista, and put back in, in a new form, in Win7)
But it won't magically be transferred to Direct2D, no.
On performance front, it is the same old farce and as per usual 'Do Your Own Benchmarking' across OS-es. But, almost a decade old OS for anything GDI still slams Windows7 and plenty of apps will be incredibly more responsive on XP.. Sadness.. especially when you consider that translation of such an old API (as a compatible interface) should be trivial to any new driver or display tech.
Apparently some ops like blitting are supported but look at the result of your target 2D GDI app and judge for yourself..
Here are some observations, but please do your own for a dozen scenarios and compare, especially if it is GDI intensive like a million audio/video apps out there (no wonder iFruit boys are gaining share).
http://www.passmark.com/forum/showthread.php?t=2233
And while you will find all the typical and fluffy MSDN blog explanations that get 'technical' (ie. surface-style nonsense) the reason is very simple: buy a new OS, pull the carpet on old API and complicate it further by allowing new APIs to work with it (but not benefit the old one, easily doable by providing a new dll and .lib ).
For one history lesson and how hard it was to translate GDI calls to Direct2D or use libgdiplus from Mono and derive ideas etc, here is the propaganda:
http://blogs.msdn.com/directx/archive/2009/05/12/2d-drawing-apis-in-windows.aspx
How would I create a new desktop in C++?
I know the CreateDesktop() API but it does not load memus or explorer.exe for the matter.
If not to much trouble would love an example to make a desktop with menus.
Take a look at Window Stations, this may be what your looking for.
However, this also is different from a session (UAC).
The source code for how to programtically do this is included as part of this project (JobObjectWrapper).
Hey actually, I'm wrong, JobObjectWrapper only secure's that interface, the other answerer here was correct, another question had the same answer, virtuawin is open soure too.
Take a look at virtuawin (Open source)
(source: sourceforge.net)
VirtuaWin is a virtual desktop manager
for the Windows operating system
(Win9x/ME/NT/Win2K/XP/Win2003/Vista).
A virtual desktop manager lets you
organize applications over several
virtual desktops (also called
'workspaces'). Virtual desktops are
very common in Unix/Linux, and once
you get accustomed to using them, they
become an essential part of a
productive workflow.