IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Plateformes Discussion :

Qt et DWM (Aero) [Windows]


Sujet :

Plateformes

  1. #1
    Membre régulier
    Profil pro
    Étudiant
    Inscrit en
    Novembre 2009
    Messages
    65
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Novembre 2009
    Messages : 65
    Points : 104
    Points
    104
    Par défaut Qt et DWM (Aero)
    Je suis en train de développer une appli avec une fenêtre dont le cadre est personnalisé, comme le sont par exemple office, Opera, Chrome, avec la transparence Aero.

    J'ai réussi à créer une telle fenêtre, voir la pièce jointe.

    Le problème est que quand la fenêtre est maximisée : la transparence disparait, et je me retrouve avec du noir à la place. De plus, les bordures dépassent.
    J'ai fait un screen mais ce n'est pas super-visible

    Comment puis-je faire pour rétablir la transparence lorsque la fenêtre est maximisée ?

    Code source :

    AMainWindow.h
    Code c++ : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
     
    #ifndef ___AMainWindow
    #define ___AMainWindow
     
    #include <QtGui/QWidget>
    #include <QtGui/QLabel>
    #include <QtGui/QPushButton>
    #ifdef Q_OS_WIN
    #include "AWindowsHelper.h"
    #endif
     
    class AMainWindow : public QWidget {
        Q_OBJECT
     
    public:
        AMainWindow(QWidget* = 0);
     
    private:
    	QLabel* windowTitle;
    	QPushButton* systemMenu;
     
    #ifdef Q_OS_WIN
    private:
    	AWindowsHelper* wHelper;
     
    protected:
    	bool winEvent(MSG*, long*);
    	void paintEvent(QPaintEvent*);
    #endif
    };
     
    #endif

    AWindowsHelper.h
    Code c++ : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
     
    #ifndef ___AWindowsHelper
    #define ___AWindowsHelper
     
    #include <QtGui/QWidget>
    #include <windows.h>
    #include <windowsx.h>
     
    class AWindowsHelper : public QObject {
        Q_OBJECT
     
    public:
        AWindowsHelper(QObject* = 0);
     
    	enum AeroState {
    		AeroUnaviable,
    		AeroUnaviableThemed,
    		AeroClassic,
    		AeroBasic,
    		AeroAviable
    	};
     
    	bool winEvent(MSG*, long*);
    	void paintEvent(QPaintEvent*);
    	AeroState aeroState();
     
    private:
    	typedef struct {
    		int cxLeftWidth;
    		int cxRightWidth;
    		int cyTopHeight;
    		int cyBottomHeight;
    	} WMargins;
     
    	typedef BOOL (WINAPI *T_IsAppThemed)(void);
    	typedef HRESULT (WINAPI *T_DwmIsCompositionEnabled)(BOOL* pfEnabled);
    	typedef BOOL (WINAPI *T_DwmDefWindowProc)(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam, LRESULT* plResult);
    	typedef HRESULT (WINAPI *T_DwmExtendFrameIntoClientArea)(HWND hwnd, WMargins* pMarInset);
     
    	T_IsAppThemed F_IsAppThemed;
    	T_DwmIsCompositionEnabled F_DwmIsCompositionEnabled;
    	T_DwmDefWindowProc F_DwmDefWindowProc;
    	T_DwmExtendFrameIntoClientArea F_DwmExtendFrameIntoClientArea;
     
    	AeroState cachedState;
    	QWidget* w;
    	bool dirty;
    };
     
    #endif

    AMainWindow.cc
    Code c++ : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
     
    #include "AMainWindow.h"
    #include <QtGui/QStyle>
     
    AMainWindow::AMainWindow(QWidget* parent) : QWidget(parent) {
    	setWindowTitle("Crash Test");
    	setWindowFlags(Qt::Window);
    #ifdef Q_OS_WIN
    	wHelper = new AWindowsHelper(this);
    #endif
     
    	QLabel* windowTitle = new QLabel(this);
    	windowTitle->setText(QString::fromUtf8("<b>Qt custom frame</b> - Crash test"));
     
    	int frameWidth = style()->pixelMetric(QStyle::PM_MdiSubWindowFrameWidth);
    	int titleHeight = style()->pixelMetric(QStyle::PM_TitleBarHeight);
    	windowTitle->setGeometry(frameWidth + 20, 0, width() - 2 * frameWidth - 20, titleHeight);
    	windowTitle->setAlignment(Qt::AlignLeft | Qt::AlignVCenter);
     
    	systemMenu = new QPushButton(this);
    	systemMenu->setGeometry(frameWidth, frameWidth, 16, titleHeight - 2 * frameWidth);
    }
     
    #ifdef Q_OS_WIN
    bool AMainWindow::winEvent(MSG* m, long* l) {
    	return wHelper->winEvent(m, l);
    }
     
    void AMainWindow::paintEvent(QPaintEvent* e) {
    	wHelper->paintEvent(e);
    }
    #endif

    AWindowsHelper.cc
    Code c++ : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
     
    #include "AWindowsHelper.h"
    #include <QtCore/QLibrary>
    #include <QtCore/QSysInfo>
    #include <QtGui/QStyle>
    #include <QtGui/QApplication>
    #include <QtGui/QLabel>
    #include <QtGui/QPainter>
    #include "AMainWindow.h"
     
    AWindowsHelper::AWindowsHelper(QObject* parent) : QObject(parent) {
    	// Loads library symbols
    	cachedState = AeroUnaviable;
    	dirty = true;
     
    	if(QSysInfo::WindowsVersion >= QSysInfo::WV_VISTA) cachedState = AeroClassic;
     
    	if(QSysInfo::WindowsVersion <= QSysInfo::WV_XP) {
    		// Version older than XP doesn't support anything.
    		return;
    	}
     
    	// UxTheme : XP and later
    	QLibrary uxLib(QString::fromUtf8("uxtheme"));
     
    	F_IsAppThemed = (T_IsAppThemed)uxLib.resolve("IsAppThemed");
    	if(F_IsAppThemed == 0) return;
    	cachedState = F_IsAppThemed() == TRUE ? AeroUnaviableThemed : AeroUnaviable;
     
    	if(QSysInfo::WindowsVersion == QSysInfo::WV_XP || QSysInfo::WindowsVersion == QSysInfo::WV_2003) return;
     
    	// DwmApi : Vista and later
    	QLibrary dwmLib(QString::fromUtf8("dwmapi"));
     
    	F_DwmIsCompositionEnabled = (T_DwmIsCompositionEnabled)dwmLib.resolve("DwmIsCompositionEnabled");
    	F_DwmDefWindowProc = (T_DwmDefWindowProc)dwmLib.resolve("DwmDefWindowProc");
    	F_DwmExtendFrameIntoClientArea = (T_DwmExtendFrameIntoClientArea)dwmLib.resolve("DwmExtendFrameIntoClientArea");
     
    	w = qobject_cast<QWidget*>(parent);
    	if(w == 0) return;
     
    	w->setAttribute(Qt::WA_TranslucentBackground);
    	w->setAttribute(Qt::WA_NativeWindow);
    }
     
    bool AWindowsHelper::winEvent(MSG* msg, long* result) {
    	bool fCallDwp = true;
    	LRESULT lRet = 0;
    	HWND hWnd = w->winId();
    	UINT message = msg->message;
     
    	fCallDwp = !F_DwmDefWindowProc(hWnd, message, msg->wParam, msg->lParam, &lRet);
     
    	if(message != WM_ACTIVATE && message != WM_NCCALCSIZE && message != WM_NCHITTEST && message != WM_PAINT) return false;
     
    	if(message == WM_ACTIVATE) {
    		RECT rcClient;
    		GetWindowRect(hWnd, &rcClient);
     
    		SetWindowPos(hWnd, NULL, rcClient.left, rcClient.top,
    			rcClient.right - rcClient.left,
    			rcClient.bottom - rcClient.top,
    			SWP_FRAMECHANGED
    			);
     
    		int frameWidth = w->style()->pixelMetric(QStyle::PM_MdiSubWindowFrameWidth);
     
    		WMargins mar;
    		mar.cxLeftWidth = frameWidth;
    		mar.cxRightWidth = frameWidth;
    		mar.cyBottomHeight = frameWidth;
    		mar.cyTopHeight = w->style()->pixelMetric(QStyle::PM_TitleBarHeight);
     
    		F_DwmExtendFrameIntoClientArea(hWnd, &mar);
     
    		fCallDwp = true;
    		lRet = 0;
    	}
     
    	if(message == WM_PAINT) {
    		w->update();
     
    		fCallDwp = true;
    		lRet = 0;
    	}
     
    	if((message == WM_NCCALCSIZE) && (msg->wParam == TRUE)) {
    		NCCALCSIZE_PARAMS* ncsize = reinterpret_cast<NCCALCSIZE_PARAMS*>(msg->lParam);
     
    		ncsize->rgrc[0].left += 0;
    		ncsize->rgrc[0].top += 0;
    		ncsize->rgrc[0].right -= 0;
    		ncsize->rgrc[0].bottom -= 0;
     
    		lRet = 0;
    		fCallDwp = false;
    	}
     
    	if((message == WM_NCHITTEST) && (lRet == 0)) {
    		LRESULT lDwmRet = lRet;
    		//F_DwmDefWindowProc(hWnd, message, msg->wParam, msg->lParam, &lDwmRet);
     
    		if(lDwmRet != HTCLOSE &&
    			lDwmRet != HTMINBUTTON &&
    			lDwmRet != HTMAXBUTTON &&
    			lDwmRet != HTHELP) {
     
    			POINT hitPoint = { GET_X_LPARAM(msg->lParam), GET_Y_LPARAM(msg->lParam) };
    			RECT rcWindow;
    			GetWindowRect(hWnd, &rcWindow);
     
    			int frameWidth = w->style()->pixelMetric(QStyle::PM_MdiSubWindowFrameWidth);
     
    			short xPos = 1;
    			short yPos = 2;
     
    			if(hitPoint.x > rcWindow.left && hitPoint.x < (rcWindow.left + frameWidth)) {
    				xPos = 0;
    			}
     
    			if(hitPoint.x < rcWindow.right && hitPoint.x > (rcWindow.right - frameWidth)) {
    				xPos = 2;
    			}
     
    			if(hitPoint.y > rcWindow.top && hitPoint.y < (rcWindow.top + frameWidth)) {
    				yPos = 0;
    			}
     
    			if(hitPoint.y > (rcWindow.top + frameWidth) && hitPoint.y < (rcWindow.top + w->style()->pixelMetric(QStyle::PM_TitleBarHeight))) {
    				yPos = 1;
    			}
     
    			if(hitPoint.y < rcWindow.bottom && hitPoint.y > (rcWindow.bottom - frameWidth)) {
    				yPos = 3;
    			}
     
    			if(xPos == 0 && yPos == 0) lRet = HTTOPLEFT;
    			else if(xPos == 1 && yPos == 0) lRet = HTTOP;
    			else if(xPos == 2 && yPos == 0) lRet = HTTOPRIGHT;
    			else if(xPos == 0 && yPos == 1) lRet = HTLEFT;
    			else if(xPos == 1 && yPos == 1) lRet = HTCAPTION;
    			else if(xPos == 2 && yPos == 1) lRet = HTRIGHT;
    			else if(xPos == 0 && yPos == 2) lRet = HTLEFT;
    			else if(xPos == 1 && yPos == 2) lRet = HTCLIENT;
    			else if(xPos == 2 && yPos == 2) lRet = HTRIGHT;
    			else if(xPos == 0 && yPos == 3) lRet = HTBOTTOMLEFT;
    			else if(xPos == 1 && yPos == 3) lRet = HTBOTTOM;
    			else if(xPos == 2 && yPos == 3) lRet = HTBOTTOMRIGHT;
     
    			QWidget* wAt = QApplication::widgetAt(hitPoint.x, hitPoint.y);
    			if(wAt != 0 && wAt != w && qobject_cast<QLabel*>(wAt) == 0) {
    				lRet = HTCLIENT;
    			}
     
    			fCallDwp = false;
    		}
    	}
     
    	*result = lRet;
    	return !fCallDwp;
    }
     
    void AWindowsHelper::paintEvent(QPaintEvent*) {
    	QPainter p(w);
     
    	p.setPen(Qt::NoPen);
    	p.setBrush(QApplication::palette().background());
     
    	int frameWidth = w->style()->pixelMetric(QStyle::PM_MdiSubWindowFrameWidth);
     
    	p.drawRect(frameWidth, w->style()->pixelMetric(QStyle::PM_TitleBarHeight), w->width() - 2 * frameWidth,
    		w->height() - frameWidth - w->style()->pixelMetric(QStyle::PM_TitleBarHeight));
    }

    Merci d'avance

    [EDIT]
    Chose étonnante, le cadre transparent maximisé fonctionne si aucun widget n'est placé sur ma fenêtre (ce qui n'est pas trop mon interêt...)

    [EDIT]
    Les pièces jointes (devenues inutiles) ont été supprimées.

  2. #2
    Membre régulier
    Profil pro
    Étudiant
    Inscrit en
    Novembre 2009
    Messages
    65
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Novembre 2009
    Messages : 65
    Points : 104
    Points
    104
    Par défaut
    Ça y est j'ai réussi. Je comprends toujours pas pourquoi ca marchait pas, mais maintenant ca marche.

    J'ai d'ailleurs essayé de réduire un peu le code en mettant tout dans une même classe. Voici ce que ca donne :

    AMainWindow.h
    Code c++ : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
     
    #ifndef ___AMainWindow
    #define ___AMainWindow
     
    #include <QtGui/QWidget>
     
    class AMainWindow : public QWidget {
        Q_OBJECT
     
    public:
        AMainWindow(QWidget* = 0);
     
    private:
        bool winEvent(MSG*, long*);
        bool isDirty;
    };
     
    #endif

    AMainWindow.cc
    Code c++ : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
     
    #include "AMainWindow.h"
     
    #ifdef Q_OS_WIN
    #include <Windows.h>
    #include <WindowsX.h>
    #include <QtCore/QLibrary>
    #include <QtCore/QSysInfo>
    #include <QtGui/QStyle>
    #include <QtGui/QApplication>
     
    namespace Win {
        typedef struct {
            int cxLeftWidth;
            int cxRightWidth;
            int cyTopHeight;
            int cyBottomHeight;
        }  Margins;
     
        const unsigned int WM_Activate = 0x0006;
        const unsigned int WM_NCCalcSize = 0x0083;
        const unsigned int WM_NCHitTest = 0x0084;
        const unsigned int WM_ThemeChanged = 0x031A;
        const unsigned int WM_DwmCompostitionChanged = 0x031E;
        const unsigned int WM_DwmNcMouseLeave = 674;
     
        // Defines to be nicer and respect way to write
        typedef BOOL Bool;
        typedef HWND Hwnd;
        typedef UINT UInt;
        typedef WPARAM WParam;
        typedef LPARAM LParam;
        typedef LRESULT LResult;
        typedef HRESULT HResult;
     
        // Types to load dynamicly functions
        typedef Bool (WINAPI *_DwmDefWindowProc)(Hwnd, UInt, WParam, LParam, LResult*);
        typedef HResult (WINAPI *_DwmIsCompositionEnabled)(Bool*);
        typedef HResult (WINAPI *_DwmExtendFrameIntoClientArea)(Hwnd, const Margins*);
        typedef Bool (WINAPI *_IsAppThemed)();
     
        // Placeholders for functions
        static _DwmDefWindowProc DwmDefWindowProc = 0;
        static _DwmIsCompositionEnabled DwmIsCompositionEnabled = 0;
        static _DwmExtendFrameIntoClientArea DwmExtendFrameIntoClientArea = 0;
        static _IsAppThemed IsAppThemed = 0;
    }
     
    #endif
     
    AMainWindow::AMainWindow(QWidget* parent) : QWidget(parent) {
        setWindowFlags(Qt::Window);
        setAttribute(Qt::WA_NativeWindow);
     
        /* Builds main ui */
     
    #ifdef Q_OS_WIN
        setAttribute(Qt::WA_TranslucentBackground);
     
        if(QSysInfo::WindowsVersion < QSysInfo::WV_5_0) goto skip;
        {
            QLibrary uxLib(QString::fromUtf8("uxtheme"));
            Win::IsAppThemed = (Win::_IsAppThemed)uxLib.resolve("IsAppThemed");
        }
     
        if(QSysInfo::WindowsVersion < QSysInfo::WV_6_0) goto skip;
        {
            QLibrary dwmLib(QString::fromUtf8("dwmapi"));
            Win::DwmDefWindowProc = (Win::_DwmDefWindowProc)dwmLib.resolve("DwmDefWindowProc");
            Win::DwmExtendFrameIntoClientArea = (Win::_DwmExtendFrameIntoClientArea)dwmLib.resolve("DwmExtendFrameIntoClientArea");
            Win::DwmIsCompositionEnabled = (Win::_DwmIsCompositionEnabled)dwmLib.resolve("DwmIsCompositionEnabled");
        }
     
    skip:;
    #endif
    }
     
    #ifdef Q_OS_WIN
    bool AMainWindow::winEvent(MSG* msg, long* result) {
        Win::Hwnd hWnd = winId();
        Win::LParam lParam = msg->lParam;
        Win::WParam wParam = msg->wParam;
        Win::UInt message = msg->message;
        bool retVal = true;
     
        switch(msg->message) {
            case Win::WM_NCHitTest: {
                Win::LResult lResult;
                Win::DwmDefWindowProc(hWnd, message, wParam, lParam, &lResult);
                if(lResult == HTCLOSE ||
                    lResult == HTMAXBUTTON ||
                    lResult == HTMINBUTTON ||
                    lResult == HTHELP
                ) {
                    *result = lResult;
                    return retVal;
                }
     
                RECT rcWindow;
                GetWindowRect(hWnd, &rcWindow);
     
                short uRow = 2;
                short uCol = 1;
     
                int frameBorder = style()->pixelMetrix(QStyle::PM_MdiSubWindowFrameWidth);
                int frameTitle = style()->pixelMetric(QStyle::PM_TitleBarHeight);
     
                POINT hitPoint = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) };
     
                if(hitPoint.y > rcWindow.top && hitPoint.y < rcWindow.top + frameBorder) {
                    uRow = 0;
                }
     
                if(hitPoint.y >= rcWindow.top + frameBorder && hitPoint.y < rcWindow.top + frameTitle + frameBorder) {
                    uRow = 1;
                }
     
                if(hitPoint.y < rcWindow.bottom && hitPoint.y > rcWindow.bottom - frameBorder) {
                    uRow = 3;
                }
     
                if(hitPoint.x > rcWindow.left && hitPoint.x < rcWindow.left + frameBorder) {
                    uCol = 0;
                }
     
                if(hitPoint.x < rcWindow.right && hitPoint.x > rcWindow.right - frameBorder) {
                    uCol = 2;
                }
     
                {
                    short getFrameZone[4][3] = {
                        { HTTOPLEFT, HTTOP, HTTOPRIGHT },
                        { HTLEFT, HTCAPTION, HTRIGHT },
                        { HTLEFT, HTNOWHERE, HTRIGHT },
                        { HTBOTTOMLEFT, HTBOTTOM, HTBOTTOMRIGHT }
                    };
     
                    *result = getFrameZone[uRow][uCol];
                }
     
                if(*result == HTNOWHERE) retVal = false;
     
                QWidget* wAt = QApplication::widgetAt(hitPoint.x, hitPoint.y);
                if(wAt != 0 && wAt != this && qobject_cast<QLabel*>(wAt) == 0) {
                    *result = HTCLIENT;
                }
     
                break;
            } // case Win::WM_NcHitTest
            case Win::WM_NCCalcSize: {
                NCCALCSIZE_PARAMS* ncsize = reinterpret_cast<NCCALCSIZE_PARAMS*>(lParam);
     
                DefWindowProc(hWnd, message, wParam, lParam);
     
                int frameBorder = style()->pixelMetric(QStyle::PM_MdiSubWindowFrameWidth);
                int frameTitle = style()->pixelMetric(QStyle::PM_TitleBarHeight);
     
                ncsize->rgrc[0].top -= frameTitle;
                ncsize->rgrc[0].left -= 0;
                ncsize->rgrc[0].right += 0;
                ncsize->rgrc[0].bottom += 0;
     
                *result = 0;
     
                break;
            } // case Win::WM_NcCalSize
            case Win::WM_Activate: {
                RECT rcClient;
                GetWindowRect(hWnd, &rcClient);
     
                SetWindowPos(hWnd, 0,
                    rcClient.left,
                    rcClient.right,
                    rcClient.right - rcClient.left,
                    rcClient.bottom - rcClient.top,
                    SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOSIZE
                );
     
                int frameBorder = style()->pixelMetric(QStyle::PM_MdiSubWindowFrameWidth);
                int frameTitle = style()->pixelMetric(QStyle::PM_TitleBarHeight);
     
                Win::Margins mar;
                mar.cxLeftWidth = 0;
                mar.cxRightWidth = 0;
                mar.cyBottomHeight = 0;
                mar.cyTopHeight = frameTitle + frameBorder;
     
                Win::DwmExtendFrameIntoClientArea(hWnd, &mar);
     
                break;
            } // case Win::Wm_Activate
            case WM_NCMOUSEMOVE:
            case WM_NCLBUTTONDOWN:
            case WM_NCLBUTTONUP:
            case Win::WM_DwmNcMouseLeave: {
                Win::LResult lResult;
                Win::DwmDefWindowProc(hWnd, message, wParam, lParam, &lResult);
                *result = DefWindowProc(hWnd, message, wParam, lParam);
                break;
            } // case Win::WM_DwmNcMouseLeave
            case WM_NCPAINT:
                update();
                retVal = false;
                break;
            default:
                retVal = false;
            } // Switch
     
            return retVal;
        }
    #endif

  3. #3
    yan
    yan est déconnecté
    Rédacteur
    Avatar de yan
    Homme Profil pro
    Ingénieur expert
    Inscrit en
    Mars 2004
    Messages
    10 033
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 42
    Localisation : France, Ille et Vilaine (Bretagne)

    Informations professionnelles :
    Activité : Ingénieur expert
    Secteur : High Tech - Multimédia et Internet

    Informations forums :
    Inscription : Mars 2004
    Messages : 10 033
    Points : 13 968
    Points
    13 968
    Par défaut

    pour le code

  4. #4
    Membre régulier
    Profil pro
    Étudiant
    Inscrit en
    Novembre 2009
    Messages
    65
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Novembre 2009
    Messages : 65
    Points : 104
    Points
    104
    Par défaut
    Citation Envoyé par yan Voir le message

    pour le code
    Mais de rien

    Enfin, le code au dessus n'est pas totalement fonctionnel. Mais comme je suis partageur (on dit "partisan de l'open source" ), j'ai mis ca sur le projet Sourceforge que j'avais monté pour. Le code est pas encore fonctionnel à 100% (quelques petits problèmes avec QPainter, 'vais essayer de voir ça) mais c'est déjà mieux que le brouillon au dessus (support des thèmes Aero Basic et Windows Classic), pis surtout pas à avoir à réécrire tout le code ci dessus... Je donnerai des infos quand ce sera finis (si je trouve ou on fait ça), parce que là je m'éliogne (un peu) du sujet initial...

    https://sourceforge.net/projects/qdwm/

  5. #5
    Nouveau Candidat au Club
    Profil pro
    Inscrit en
    Juillet 2012
    Messages
    1
    Détails du profil
    Informations personnelles :
    Localisation : France, Haute Savoie (Rhône Alpes)

    Informations forums :
    Inscription : Juillet 2012
    Messages : 1
    Points : 1
    Points
    1
    Par défaut
    you're my god!

    Merci beaucoup et bravo!

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. Comment activer/désactiver les effets de flou de DWM? (FAQ)
    Par zubrow dans le forum Windows Vista
    Réponses: 3
    Dernier message: 01/12/2007, 22h15
  2. [Vista] Utilisation d'AERO
    Par kuja2053 dans le forum Windows Vista
    Réponses: 3
    Dernier message: 20/03/2007, 20h08
  3. Vista, aero et sortie TV
    Par edenyorke dans le forum Windows Vista
    Réponses: 4
    Dernier message: 05/03/2007, 13h59
  4. [ntel 915] Aero sur Vista
    Par hélènasay dans le forum Windows Vista
    Réponses: 3
    Dernier message: 22/02/2007, 15h45
  5. Besoin d'images de AERO
    Par pc152 dans le forum Windows Vista
    Réponses: 7
    Dernier message: 27/08/2006, 21h38

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo