GetRandomRgn() Api does not work as expected in Windows 8 - winapi

I am using GetRandomRgn() API to get the visible region of the window.
This API works fine in Windows Xp and Windows 7 but same API is not giving the same
result in Windows 8.
Is there is any other function available in windows 8 to give me the same result?
Please do reply.
Best Regards,
Sharad

Enable Desktop Composition on Windows 7 and you'll see that Windows 7 and Windows 8 behave the same. The behavior of GetRandomRgn is affected by desktop composition. When composition is enabled, all windows are logically treated as fully visible (since they render to an offscreen buffer). The available of features like Flip3D shows that the logically visible portion of a region is not the same as its physically visible region.

Related

LaunchUriAsync with split screen not working in Windows 10

Using the ViewSizePreference.UseHalf works great for a Windows 8.1 app running in Windows 8.1. However, when I run the same app on Windows 10, I don't get the split screen effect. I guess that may be expected behavior as the UI is quite different, but wondering if there is any kind of workaround for this.
Thanks.
Split screen launching (that is, ViewSizePreference.UseHalf) is only supported in tablet mode.

windows 8 glass effect

I am asking how to make a glass effect for winform in windows 8.
I just saw some methods which call the DWM to make this before windows 8. But it seems DWM was no longer valid in windows 8. So is there any other methods to make glass effect winform in windows 8?
Thanks!
Windows 8 does not provide support for the glass effect of Vista/7. If you want to make your windows display with glass effect, you need to code it yourself, or use one of the 3rd party solutions that do so.

How to detect if Windows 8 is showing desktop

In a Windows desktop application written in C# and running on Windows 8 how can I detect if Windows 8 is in desktop mode (i.e. showing the Desktop rather than the modern UI)?
Although it's in C++, the Start Screen Visibility Sample should be a good starting point for you. It uses COM objects to get the state of all monitors on the system that are either displaying Windows Store Apps or the Start Screen, and illustrates how to receive notifications when the state of a monitor changes or when the visibility of the Start screen changes.

Is DwmIsCompositionEnabled still of use in Windows 8?

According to Enable and Control DWM Composition:
Note As of Windows 8, the information in this section is no longer
valid. DWM can no longer be programmatically disabled, nor is it
disabled when an application attempts to draw to the primary display
surface. The following information applies to only Windows 7 and
earlier systems.
OK. So we can no longer programmatically disable DWM. But can it still be disabled? Will pfEnabled of DwmIsCompositionEnabled always be set to TRUE on Windows 8?
If composition can be disabled somehow, is DwmIsCompositionEnabled still somewhat useful in any manner?
According to Desktop Window Manager is always on (Windows) on MSDN:
In Windows 8, Desktop Window Manager (DWM) is always ON and cannot be
disabled by end users and apps.
In Windows 8, DWM desktop composition is a core operating system
component and cannot be disabled. With a few exceptions, desktop
composition is always on; it’s started before the user logon and
remains active for the duration of a session.
All of the options for disabling desktop composition that exist in
Window 7 are removed
Apps cannot use DwmEnableComposition to disable desktop composition.
In order to maintain backward compatibility, a call to this API will
return success; however, desktop composition is not disabled
Well, there's a pretty definitive answer. I'm somewhat curious what the "with a few exceptions" refers to, though... please add a comment if you happen to know. :)
Contrary to what people mention ("they removed the code", "the Basic theme is no longer there", etc.) the old visual style is alive and well in Windows 8.
The only problem is that it's not so clear how to use it for normal applications!
This isn't disabling DWM per se, but it is certainly disabling composition: just download the PowerToy Calculator for Windows XP and try running it in compatibility mode in Windows 8, and you'll see the old theme is still there:

Is there an analogue of Windows Phone 'User Idle Detection' in Windows 8?

I've used the following code on Windows Phone 7 and 8 to disable user idle detection when my App is displaying data to the user and they are unlikely to interact with the screen e.g. A recipe App where the screen needs to stay on:
http://msdn.microsoft.com/en-us/library/microsoft.phone.shell.phoneapplicationservice.useridledetectionmode(v=vs.92).aspx
Does anyone know if there is an analogue of this available for Windows 8 applications? My tablet app has the same requirement to disable the screen turning off. I haven't managed to find anything :-(
Many thanks,
Jon
You should use the DisplayRequest class, specifically DisplayRequest.RequestActive for this purpose. You must also remember to call DisplayRequest.RequestRelease once you are done to allow the display to sleep, for example, if you are not viewing a recipe, or you are in a menu screen, etc.

Resources