[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pykde
Subject:    [PyQt] Using Windows DwmApi
From:       Knacktus <knacktus () googlemail ! com>
Date:       2011-11-03 7:22:56
Message-ID: 4EB24150.4000205 () googlemail ! com
[Download RAW message or body]

Hi guys,

I want use the DwmApi on Windows 7. Mainly the 
DwmExtendFrameIntoClientArea method.

The API doc is here:

http://msdn.microsoft.com/library/ms748975.aspx

and a Qt Example here:

http://nicug.blogspot.com/2011/03/qt-windows-7-extend-frame-into-client.html

I'm trying to use the Python ctypes module to call the native method.

The Code is here:

#######################################################
import sys
from ctypes import *

from PyQt4 import QtGui
from PyQt4 import QtCore

# struct needed as input for DwmExtendFrameIntoClientArea
class Margins(Structure):
     _fields_ = [("cxLeftWidth", c_int),
                 ("cxRightWidth", c_int),
                 ("cyTopHeight", c_int),
                 ("cyBottomHeight", c_int)]

margins = Margins(-1, -1, -1, -1)

app = QtGui.QApplication(sys.argv)
w = QtGui.QWidget()

w_handle = w.winId()

# The question is how to create proper args
proper_w_handle_arg = byref(c_int(w_handle))
proper_margins_arg = byref(margins)

# From an Internet research I assume windll for stdcall convention
# but not sure, really
windll.DwmApi.DwmExtendFrameIntoClientArea(proper_w_handle_arg, 
proper_margins_arg)

w.show()
app.exec_()
########################################################

1) I'm not 100 % sure about the calling convention (windll vs. cdll)
2) It seems I don't get the arguments right.

How do I do it properly?

Cheers,

Jan
_______________________________________________
PyQt mailing list    PyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic