Bonjour,

J'affiche une fenêtre windows, mais qui a un comportement bizarre.
Bonjour,

J'affiche une fenêtre windows, mais qui a un comportement bizarre.

Lorsque je l'agrandi via le bouton "Agrandir", elle passe en taille maximun un bref instant puis reviens à sa taille d'origine.
De même pour la minimizer, si je clique sur "réduire" elle ne reste pas dans la barre des tâches.

Par contre je peut changer sa taille avec la souris à partir d'un des coins de la fenetre sans probleme.


J'ai enlever la plupart du code pour ne laisser que l'essentiel mais j'ai toujours le problème.

Est-ce que quelqu'un a déjà eu le pb ?
D'ou cela peut-il venir ?

Merci de vos réponses

mon code:
Code : 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
#include <windows.h>
//#include "logger.h"


LRESULT CALLBACK Wproc (HWND, UINT , WPARAM , LPARAM );

//#include "fenetre.h"


int WINAPI WinMain (HINSTANCE hThisInstance, HINSTANCE hPrevInstance, LPSTR lpszArgument, int nShow)
{
DWORD dw = GetLastError();

 //   logger::Log("log_logic.txt");
 //   flux <<"*** debut du programme" << std::endl;


        WNDCLASSEX m_wndclassex;
        HINSTANCE m_hinst;
        HWND m_hwnd;
        MSG msg;

        m_hinst = (HINSTANCE)GetModuleHandle(NULL);

        m_wndclassex.cbSize = sizeof (WNDCLASSEX);
        m_wndclassex.style = CS_OWNDC; // CS_DBLCLKS | CS_HREDRAW | CS_VREDRAW | CS_OWNDC;                  // Catch double-clicks
        m_wndclassex.lpfnWndProc = (WNDPROC) Wproc;//wndProc;      // This function is called by windows
        m_wndclassex.cbClsExtra = 0;                      // No extra bytes after the window class
        m_wndclassex.cbWndExtra = 0;                      // structure or the window instance
        m_wndclassex.hInstance = m_hinst;
        m_wndclassex.hIcon = LoadIcon (NULL, IDI_APPLICATION);
        m_wndclassex.hCursor = LoadCursor (NULL, IDC_ARROW);
        m_wndclassex.hbrBackground	= (HBRUSH) GetStockObject (BLACK_BRUSH);
        m_wndclassex.lpszMenuName = NULL;                 // No menu


        m_wndclassex.lpszClassName = "toto";
        m_wndclassex.hIconSm = NULL;

    if (!RegisterClassEx (&m_wndclassex))
    {
        ::MessageBox (0, "m_wndclassex", "Create", MB_ICONEXCLAMATION | MB_OK);
  //      flux << "erreur dw:" << dw << std::endl;
  //      ExitProcess(dw);

    }


    m_hwnd = CreateWindowEx(	0, //WS_EX_APPWINDOW | WS_EX_WINDOWEDGE,	//	 Extended Style For The Window
								"toto",							// Class Name
								"titre",								// Window Title
								WS_OVERLAPPEDWINDOW ,//|							// Defined Window Style
							//	WS_CLIPSIBLINGS |					// Required Window Style
							//	WS_CLIPCHILDREN,					// Required Window Style
								0, 0,								// Window Position
								800,	// Calculate Window Width
								600,	// Calculate Window Height
								NULL,								// No Parent Window
								NULL,								// No Menu
								(HINSTANCE)GetModuleHandle(NULL), //m_hinst,							// Instance
								NULL);							// Dont Pass Anything To WM_CREATE

 //   flux  << m_hwnd << std::endl;

    dw = GetLastError();
    if (!m_hwnd)
    {
        ::MessageBox (0, "erreur", "fenetre::Create", MB_ICONEXCLAMATION | MB_OK);
        //exit(1);
  //      flux << "erreur dw:" << dw << std::endl;
   //     ExitProcess(dw);

    }

    ::ShowWindow (m_hwnd, true);

    int finboucle = false;
    while ( !finboucle)
    {
        if (PeekMessage(&msg,NULL,0,0,PM_REMOVE))	// Is There A Message Waiting?
		{
			if (msg.message==WM_QUIT )//|| keys[VK_ESCAPE] == true  )				// Have We Received A Quit Message?
			{
				finboucle = true;							// If So done=TRUE
				break;
			}
			else									// If Not, Deal With Window Messages
			{
				TranslateMessage(&msg);				// Translate The Message
				DispatchMessage(&msg);				// Dispatch The Message
			}
			::ShowWindow (m_hwnd, true);
		}
    }

 //   flux <<"*** fin du programme" << std::endl;
    return 0;

}


LRESULT CALLBACK Wproc (HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam)
{

	switch (message)									// Check For Windows Messages
	{
        case WM_CREATE:
        {
      //      flux <<"WM_CREATE" << std::endl;
            return 0;
        }
		case WM_CLOSE:								// Did We Receive A Close Message?
		{
			PostQuitMessage(0);						// Send A Quit Message
			return 0;								// Jump Back
		}

        default:
            return DefWindowProc(hwnd, message, wparam, lparam);
	}
}