[python-win32] Re: dualview/extended desktop settings with win32api

Roger Upole rwupole at msn.com
Thu May 4 12:17:23 CEST 2006


Stefan Rank wrote:
> Hi,
> 
> I am trying to write scripts for changing the "extended desktop" 
> settings in windows.
> More specifically: I'd like to have a script for toggling between 
> "laptop-screen-only" and
> "extended-desktop-with-the-secondary-monitor-bottom-right-and- 
> please-don't-forget-the-arrangement-every-time-I-open-the-display-settings... 
> grmph".
> 
> AFAICT I need the GDI function `ChangeDisplaySettingsEx` and 
> `EnumDisplayDevices` and some others.
> 
> (see 
> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdi/monitor_4zak.asp)
> 
> win32api exposes ChangeDisplaySettings only. (and btw I am not sure how 
> to use and manipulate the pyDEVMODE.Fields that EnumDisplaySettings 
> returns, is there an example somewhere?).

Fields is a bitmask indicating which members of the DEVMODE
are significant for a particular operation.  Use a bitwise or of win32con.DM_*
flags.  print_desktop.py in the demos directory uses it.

> 
> I wanted to ask if there is a chance that these api parts will get into 
> pywin32?
> Or if I wanted to add them myself, is there something that I missed that 
> prevents adding it (and related structures) to win32apimodule.cpp ?
> 

These functions can certainly be added.  It will take some extra work
(the usual LoadLibrary/GetProcAddress thing) since many of them
don't exist on WinNT.  You can submit a feature request (or patch)
on SourceForge: http://sourceforge.net/projects/pywin32/

       Roger






More information about the Python-win32 mailing list