Bonjour,

Pourquoi quand je dessine un rectangle, il apparaît aussi dans l'autre fenêtre IDD_DIALOG2 ?

voici le code complet :
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
 
#include "code.h"
#include <Commctrl.h>
#include <string.h>
 
HINSTANCE hInst;
HWND hdlg,hactive;
 
//********************
BOOL CALLBACK DlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
	hdlg=hwnd;
	switch(msg)
	{
	case WM_COMMAND:
	{
		switch (LOWORD(wParam))
		{
			case IDOK:
				DialogBox(0,MAKEINTRESOURCE(IDD_DIALOG2), hdlg, DlgProc);
			break;
		}
		break;
	}
 
	case WM_PAINT:
	{	
		PAINTSTRUCT ps; 
		HDC hdc;
		hdc = BeginPaint(hwnd, &ps);
		HBRUSH BrushBlack  = CreateSolidBrush(RGB(0, 0, 0));
 
		SelectObject(hdc, BrushBlack);
		Rectangle(hdc, 000, 100, 400, 200);
		EndPaint(hwnd, &ps);
	break;
	 }
 
	case WM_CLOSE:
	{
		EndDialog(hwnd,0);
	    break;
	}
 
 
	default:
	return FALSE;
	}
		return TRUE;
	}
//********************
int WINAPI WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,LPSTR lpCmdLine,int nShowCmd)
{
	DialogBox(hInstance,MAKEINTRESOURCE(IDD_DIALOG1),NULL,DlgProc);
	return 0;
}
//********************