Win32 problème.

Résolu
cs_TeniX Messages postés 118 Date d'inscription mercredi 24 décembre 2003 Statut Membre Dernière intervention 11 décembre 2011 - 5 mars 2006 à 12:54
cs_TeniX Messages postés 118 Date d'inscription mercredi 24 décembre 2003 Statut Membre Dernière intervention 11 décembre 2011 - 5 mars 2006 à 17:07
Salut, Voila j'ai crée de maniere simple une source qui exprime mon problème , je trouve pas la source du problème , enfaite quand les fenêtres sont l'une au dessus de l'autre il y a des problème de rafraichissement

-> screen: http://pkzm62.free.fr/view.JPG

voila mon code:

#########################
#########################

#include <windows.h>

LRESULT CALLBACK WindowProcedure (HWND, UINT, WPARAM, LPARAM);
LRESULT CALLBACK test (HWND, UINT, WPARAM, LPARAM);
LRESULT CALLBACK test2 (HWND, UINT, WPARAM, LPARAM);

char szClassName[ ] = "WindowsApp";
char szTest[] = "test";
char szTest2[] = "test2";
HWND hwndtest,hwndtest2;
HINSTANCE hInst;
CREATESTRUCT Parent;

int WINAPI WinMain (HINSTANCE hThisInstance,
HINSTANCE hPrevInstance,
LPSTR lpszArgument,
int nFunsterStil)

{
HWND hwnd;
MSG messages;
WNDCLASSEX wincl;

hInst = hThisInstance;

wincl.cbSize = sizeof(WNDCLASSEX);
wincl.style = CS_HREDRAW | CS_VREDRAW;
wincl.lpfnWndProc = WindowProcedure;
wincl.cbWndExtra = 0;
wincl.cbClsExtra = 0;
wincl.hInstance = hThisInstance;
wincl.hIcon = LoadIcon(NULL, IDI_APPLICATION);
wincl.hIconSm = LoadIcon(NULL, IDI_APPLICATION);
wincl.hCursor = LoadCursor (NULL, IDC_ARROW);
wincl.hbrBackground = (HBRUSH) COLOR_BACKGROUND;
wincl.lpszMenuName = NULL;
wincl.lpszClassName = szClassName;

if (!RegisterClassEx (&wincl))
return 0;

wincl.lpfnWndProc = test;
wincl.hbrBackground = (HBRUSH) COLOR_BACKGROUND;
wincl.lpszClassName = szTest;

if (!RegisterClassEx (&wincl))
return 0;

wincl.lpfnWndProc = test2;
wincl.hbrBackground = (HBRUSH) COLOR_BACKGROUND;
wincl.lpszClassName = szTest2;

if (!RegisterClassEx (&wincl))
return 0;

hwnd = CreateWindowEx (
0,
szClassName,
"Windows App",
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT,
CW_USEDEFAULT,
544,
375,
NULL,
NULL,
hThisInstance,
&Parent
);

ShowWindow (hwnd, nFunsterStil);

UpdateWindow(hwnd);

while (GetMessage (&messages, NULL, 0, 0))
{
TranslateMessage(&messages);
DispatchMessage(&messages);
}
return messages.wParam;
}

LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message)
{
case WM_CREATE:

hwndtest = CreateWindow ( szTest,
"test numero 1",
WS_CHILD | WS_BORDER | WS_CAPTION | WS_SYSMENU
| WS_MINIMIZEBOX,
0,0,200,200,
hwnd,
(HMENU) 1,
(HINSTANCE) GetWindowLong(hwnd,GWL_HINSTANCE) ,
NULL);

hwndtest2 = CreateWindow ( szTest2,
"test numero 2",
WS_CHILD | WS_BORDER | WS_CAPTION | WS_SYSMENU
| WS_MINIMIZEBOX,
200,0,200,200,
hwnd,
(HMENU) 2,
(HINSTANCE) GetWindowLong(hwnd,GWL_HINSTANCE) ,
NULL);

ShowWindow(hwndtest,SW_SHOW);
ShowWindow(hwndtest2,SW_SHOW);

break;

case WM_DESTROY:
PostQuitMessage (0);
break;
default:
return DefWindowProc (hwnd, message, wParam, lParam);
}

return 0;
}
LRESULT CALLBACK test (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch (msg)
{
case WM_CREATE:

break;
default:
return DefWindowProc (hwnd, msg, wParam, lParam);
}
return DefWindowProc(hwnd,msg,wParam,lParam);
}
LRESULT CALLBACK test2 (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch (msg)
{
case WM_CREATE:

break;
default:
return DefWindowProc (hwnd, msg, wParam, lParam);
}
return DefWindowProc(hwnd,msg,wParam,lParam);
}

#######################
#######################

Merci pour ceux qui s'intérésseront à mon problème

@bientot

4 réponses

cs_aardman Messages postés 1905 Date d'inscription mercredi 22 janvier 2003 Statut Membre Dernière intervention 17 septembre 2012 3
5 mars 2006 à 17:02
Salut,
Rajoute le style WS_CLIPSIBLINGS à tes deux fenetres enfants, ca evitera qu'elles se dessinent dessus.
3
cs_aardman Messages postés 1905 Date d'inscription mercredi 22 janvier 2003 Statut Membre Dernière intervention 17 septembre 2012 3
5 mars 2006 à 16:42
Salut,

t'es sur que c'est ca l'adresse de ton site ? j'arrive pas à acceder a pkzm62.free.fr.
0
cs_TeniX Messages postés 118 Date d'inscription mercredi 24 décembre 2003 Statut Membre Dernière intervention 11 décembre 2011 2
5 mars 2006 à 16:53
Oui le lien fonctionne
0
cs_TeniX Messages postés 118 Date d'inscription mercredi 24 décembre 2003 Statut Membre Dernière intervention 11 décembre 2011 2
5 mars 2006 à 17:07
Ah merci beaucoup ça fonctionne :)
0
Rejoignez-nous