开发者

Windows 7 MARGINS structure in Python

I'm attempting to get some of the more interesting Windows Aero effects working in Python.

The DwmExtendFrameIntoClientArea function can be used to extend the Aero glass into the client area. It requires a Window handle and a pointer to a MARGINS structure. I already know how to get a window's handle in Python; however, I'm unaware of how to make a margins structure.

MARGINS structure, MSDN Docs

Here is what I have so far:

import Tkinter as tk
import string
import ctypes

root = tk.Tk()

handle = string.atoi(root.wm_frame(), 0)

dwm = ctypes.windll.dwmapi

# needs pointertomarginsstruct
dwm.DwmExtendFrameIntoClientArea(handel, pointertomarginsstruct)

root.开发者_开发问答mainloop()


I do not have Win7 running to test this but try defining the struct with ctypes:

class MARGINS(ctypes.Structure):
  _fields_ = [("cxLeftWidth", c_int),
              ("cxRightWidth", c_int),
              ("cyTopHeight", c_int),
              ("cyBottomHeight", c_int)
             ]
margins = MARGINS(1, 2, 1, 1)

dwm.DwmExtendFrameIntoClientArea(handel, ctypes.byref(margins))
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜