Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to disable Vista Aero from code?

756 views
Skip to first unread message

David J Taylor

unread,
Oct 22, 2007, 5:47:21 AM10/22/07
to
It would be helpful if, in Windows Vista, I could disable Aero when my
program started, and re-enable it at the end. If this is possible, how
could I do it? I guess an API somewhere, but I can't seem to find it
right now!

Thanks,
David


Rob Kennedy

unread,
Oct 22, 2007, 10:10:25 AM10/22/07
to

Sounds like you're trying to fix a bug in your program by changing the
user's environment preferences. What's the bug?

--
Rob

Primoz Gabrijelcic

unread,
Oct 22, 2007, 11:15:27 AM10/22/07
to
David J Taylor wrote:

Don't know how, but you can check Vista Battery Saver's source code.

http://blogs.microsoft.co.il/blogs/tamir/archive/2007/05/14/Vista-Batter
y-Saver.aspx

--
Primoz

David J Taylor

unread,
Oct 22, 2007, 1:48:03 PM10/22/07
to


Thanks for your interest, Rob. This is the problem as described by the
user:

--------------------------------------------------------------
Let me explain the best I can. Under correct operation, when the mouse is
over the image area you get a reading of temperature, location and time on
the bottom. When you move the mouse away from the image area that
correctly changes to 'click to make temperature units °F'.

With Vista when the mouse is over the image there is no reading but the
menu bar at the top flashes very fast. When you move the mouse off the
image the flashing stops and then the temperature, location and time
appears ..... but for what pixel I am not sure.

Also (and clearly tied up with this) if the mouse location is in the image
area whilst the file is loading it takes ages to load with the menu bar
again flashing.
--------------------------------------------------------------


This is the program:

http://www.david-taylor.myby.co.uk/software/hrpt.htm

and it works fine in VMware (which doesn't support Aero). It's written in
Delphi 5, and doesn't support XP themes. I suggested trying compatibility
to Windows 2000 but that doesn't seem to help. Eventually, I will move
the program to Delphi 2007, but a temporary fix would be appreciated by at
least two users.

Cheers,
David


David J Taylor

unread,
Oct 22, 2007, 1:41:58 PM10/22/07
to

Primoz,

Thanks for the pointer - perhaps the answer is hidden somewhere in the
lines of source code in the different modules.....

Cheers,
David


Roy Lambert

unread,
Oct 23, 2007, 4:04:22 AM10/23/07
to
David


If you figure it out please post the code - I, and I suspect many others, will be fascinated.

Roy Lambert

David J Taylor

unread,
Oct 23, 2007, 10:20:59 AM10/23/07
to

Roy, you might want to check out here:

http://www.aeroxp.org/board/lofiversion/index.php?t6985.html

Can't vouch for it working, but at least it gives the DLL and the calls.

Cheers,
David


Ryan J. Mills

unread,
Oct 23, 2007, 10:15:29 AM10/23/07
to
There is an API call that you can supposedly make that will shut off
the "Glass" effect for certain windows while Aero is running.

Unfortunatly I've never gotten it to work and when I asked about it
here no one responded.

Here is what I can tell you:

What you want to look at is the Desktop Window Manager (DWMAPI).
Marko Binic has made a translated API unit, I'll place it in the
attachments group, and the function you want to look, according to
M$, is the DwmSetWindowAttribute call.

As I've stated I've never been able to get this call to work.

I finally gave up on it and changed my program to work differently on
Vista so that I could move on.

If any one can make this work I'd really like to know how you did it.

Ryan.

David J Taylor

unread,
Oct 23, 2007, 10:24:09 AM10/23/07
to
Ryan J. Mills wrote:
> There is an API call that you can supposedly make that will shut off
> the "Glass" effect for certain windows while Aero is running.
>
> Unfortunatly I've never gotten it to work and when I asked about it
> here no one responded.
>
> Here is what I can tell you:
>
> What you want to look at is the Desktop Window Manager (DWMAPI).
> Marko Binic has made a translated API unit, I'll place it in the
> attachments group, and the function you want to look, according to
> M$, is the DwmSetWindowAttribute call.
>
> As I've stated I've never been able to get this call to work.
>
> I finally gave up on it and changed my program to work differently on
> Vista so that I could move on.
>
> If any one can make this work I'd really like to know how you did it.
>
> Ryan.

Thanks for that, Ryan. Maybe it's the DwmEnableComposition procedure?
I'll look forward to the attchment appearing....ah, there it is now!

Thanks,
David


David J Taylor

unread,
Oct 24, 2007, 7:52:20 AM10/24/07
to
David J Taylor wrote:
[]

> Thanks for that, Ryan. Maybe it's the DwmEnableComposition procedure?
> I'll look forward to the attchment appearing....ah, there it is now!
>
> Thanks,
> David

Yes, works a treat:

_____________________________________________
procedure AeroSetEnable (enable: boolean);
const
DWM_EC_DISABLECOMPOSITION = 0;
DWM_EC_ENABLECOMPOSITION = 1;
var
ok: integer;
begin
if DWMlibrary <> 0 then
begin
if @DwmEnableComposition <> nil then
begin
if enable
then DwmEnableComposition (DWM_EC_ENABLECOMPOSITION)
else DwmEnableComposition (DWM_EC_DISABLECOMPOSITION);
end;
end;
end;

initialization
DWMlibrary := LoadLibrary ('DWMAPI.dll');
if DWMlibrary <> 0 then
begin
DwmEnableComposition := GetProcAddress (DWMLibrary,
'DwmEnableComposition');
end;
_____________________________________________

You get the idea....

Cheers,
David


Primoz Gabrijelcic

unread,
Oct 25, 2007, 4:44:01 AM10/25/07
to
David J Taylor wrote:

> David J Taylor wrote:
> []
> > Thanks for that, Ryan. Maybe it's the DwmEnableComposition
> > procedure? I'll look forward to the attchment appearing....ah,
> > there it is now!
> >
> > Thanks,
> > David
>
> Yes, works a treat:

Great! On behalf of everybody that is still struggling with Vista -
thanks for doing the research.

I've repacked your solution as two functions (DSiAeroEnable and
DSiAeroDisable) in the open sourced DSiWin32 library
(http://gp.17slon.com/gp/dsiwin32.htm) and added anoter one that checks
whether Aero is enabled (DSiIsAeroEnabled).

--
Primoz

0 new messages