What I want to do is disable windows aero permanently for the user if he / she clicks a button.
Currently I have this code:
<System.RunTime.InteropServices.DLLImport("dwmapi.dll", PreserveSig:=False)>
Public Shared Sub DwmEnableComposition(bEnable As Boolean)
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
DwmEnableComposition(False)
End Sub
The current problem with this code is... It works, but whenever you exit your application Aero switches back on.
Is there a way to prevent this?
It sounds like in windows 8 aero transparency is disabled by default.
http://www.howtogeek.com/howto/windows-vista/disable-aero-on-windows-vista/
Also, from the link: https://msdn.microsoft.com/en-us/library/windows/desktop/aa969510%28v=vs.85%29.aspx
Disabling DWM composition disables it for the entire desktop. DWM composition will be automatically enabled when all processes that have disabled composition have called DwmEnableComposition to enable it or have been terminated. The WM_DWMCOMPOSITIONCHANGED notification is sent whenever DWM composition is enabled or disabled.
So it sounds to me like you need to leave your program running. You could do something like minimize it to the task tray (as opposed to exiting it ). Who knows, maybe you can even just launch a separate executable that stays running and doesn't show up in the taskbar OR task tray. But you will have to leave the process running.