Un jeux de Casse-Tête pas très évolué...
Source / Exemple :
//*************************************
//* Liste des bibliothèques à inclure *
//*************************************
#include <windows.h>
#include <windowsx.h>
#include <string.h>
#include <time.h>
//___________________________________________________________________________________
//Variables Globales :
int Tableau[15][3];
//********************
//* ID des controles **************
//* Utilisés pour les identifiers *
//*********************************
//Bouton
#define ID_COMMAND1 1
#define ID_COMMAND2 2
#define ID_COMMAND3 3
#define ID_COMMAND4 4
#define ID_COMMAND5 5
#define ID_COMMAND6 6
#define ID_COMMAND7 7
#define ID_COMMAND8 8
#define ID_COMMAND9 9
#define ID_COMMAND10 10
#define ID_COMMAND11 11
#define ID_COMMAND12 12
#define ID_COMMAND13 13
#define ID_COMMAND14 14
#define ID_COMMAND15 15
//___________________________________________________________________________________
//****************************************
//* Procédures pour les messages windows *
//****************************************
BOOL Form_Load (HWND hwnd, CREATESTRUCT FAR* lpCreateStruct);
void Form_UnLoad (HWND hwnd);
void Form_OnCommand (HWND hwnd, int id, HWND hwndCtl, UINT codeNotify);
LONG WINAPI WndProc (HWND, UINT, WPARAM, LPARAM);
//___________________________________________________________________________________
//***************************************
//* Déclaration du nom de l'application *
//* Et de son instance *
//***************************************
char szAppName[] = "Puzzle";
HWND hwnd;
HINSTANCE hInstance;
//___________________________________________________________________________________
//******************************
//* Point d'entré du programme *
//******************************
int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInstance,
PSTR szCmdLine, int iCmdShow)
{
srand((unsigned) time(NULL));
hInstance = hInst;
//*********************************************
//* Spécification des attributs de la fenêtre *
//*********************************************
WNDCLASSEX wc;
wc.cbSize = sizeof(wc);
wc.style = CS_HREDRAW | CS_VREDRAW;
wc.lpfnWndProc = (WNDPROC) WndProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = hInstance;
wc.hIcon = LoadIcon(NULL, IDI_APPLICATION);
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
wc.hbrBackground = reinterpret_cast<HBRUSH>(COLOR_WINDOW+1);
wc.lpszMenuName = NULL;
wc.lpszClassName = szAppName;
wc.hIconSm = LoadIcon(NULL, IDI_APPLICATION);
//********************************
//* Enregistrement de la fenêtre *
//********************************
RegisterClassEx(&wc);
//**************************
//* Création de la fenêtre *
//**************************
hwnd = CreateWindow(szAppName, "Api Win32 Application",
WS_OVERLAPPEDWINDOW, CW_USEDEFAULT,
CW_USEDEFAULT, 210,
230, HWND_DESKTOP,
NULL, hInstance, NULL);
MSG msg;
//***************************
//* Affichage de la fenêtre *
//***************************
ShowWindow(hwnd, iCmdShow);
UpdateWindow(hwnd);
//************************
//* Gestion des messages *
//************************
while (GetMessage(&msg, NULL, 0, 0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return msg.wParam;
}
//___________________________________________________________________________________
//*********************************************************
//* Redirection des messages windows (Premier traitement) *
//*********************************************************
LONG WINAPI WndProc (HWND hwnd,
UINT iMsg,
WPARAM wParam,
LPARAM lParam)
{
switch (iMsg)
{
HANDLE_MSG(hwnd, WM_CREATE, Form_Load);
HANDLE_MSG(hwnd, WM_DESTROY, Form_UnLoad);
HANDLE_MSG(hwnd, WM_COMMAND, Form_OnCommand);
default: return (DefWindowProc(hwnd, iMsg, wParam, lParam));
}
}
//___________________________________________________________________________________
//*******************************************************
//* Procédure exécuter lors de a création de la feuille *
//*******************************************************
BOOL Form_Load (HWND hwnd, CREATESTRUCT FAR* lpCreateStruct)
{
//****************************
//* Création Tableau Virtuel *
//****************************
//Ranger 1 Tableau Interne
Tableau[0][0] = 0;
Tableau[0][1] = 0;
Tableau[0][2] = 1;
Tableau[1][0] = 50;
Tableau[1][1] = 0;
Tableau[1][2] = 2;
Tableau[2][0] = 100;
Tableau[2][1] = 0;
Tableau[2][2] = 3;
Tableau[3][0] = 150;
Tableau[3][1] = 0;
Tableau[3][2] = 4;
//Ranger 2 Tableau Interne
Tableau[4][0] = 0;
Tableau[4][1] = 50;
Tableau[4][2] = 5;
Tableau[5][0] = 50;
Tableau[5][1] = 50;
Tableau[5][2] = 6;
Tableau[6][0] = 100;
Tableau[6][1] = 50;
Tableau[6][2] = 7;
Tableau[7][0] = 150;
Tableau[7][1] = 50;
Tableau[7][2] = 8;
//Ranger 3 Tableau Interne
Tableau[8][0] = 0;
Tableau[8][1] = 100;
Tableau[8][2] = 9;
Tableau[9][0] = 50;
Tableau[9][1] = 100;
Tableau[9][2] = 10;
Tableau[10][0] = 100;
Tableau[10][1] = 100;
Tableau[10][2] = 11;
Tableau[11][0] = 150;
Tableau[11][1] = 100;
Tableau[11][2] = 12;
//Ranger 4 Tableau Interne
Tableau[12][0] = 0;
Tableau[12][1] = 150;
Tableau[12][2] = 13;
Tableau[13][0] = 50;
Tableau[13][1] = 150;
Tableau[13][2] = 14;
Tableau[14][0] = 100;
Tableau[14][1] = 150;
Tableau[14][2] = 15;
Tableau[15][0] = 150;
Tableau[15][1] = 150;
Tableau[15][2] = 0;
//*************************
//* On mélange les pièces *
//*************************
int Nombre1, Nombre2, Tmp;
for (int i=0; i < 200; i++)
{
Nombre1 = rand() % 16 + 1;
Nombre2 = rand() % 16 + 1;
//Changement Virtuel
Tmp = Tableau[Nombre1 - 1][2];
Tableau[Nombre1 - 1][2] = Tableau[Nombre2 - 1][2];
Tableau[Nombre2 - 1][2] = Tmp;
}
//*******************************
//* On les créer au bon endroit *
//*******************************
//Ranger 1
for (i = 0; i < 16; i++)
{
if (Tableau[i][2] == 1)
{
CreateWindow("button","1",
WS_CHILD|WS_VISIBLE|BS_DEFPUSHBUTTON,
Tableau[i][0], Tableau[i][1], 50, 50, hwnd, HMENU(ID_COMMAND1),
hInstance, NULL);
}
}
for (i = 0; i < 16; i++)
{
if (Tableau[i][2] == 2)
{
CreateWindow("button","2",
WS_CHILD|WS_VISIBLE|BS_DEFPUSHBUTTON,
Tableau[i][0], Tableau[i][1], 50, 50, hwnd, HMENU(ID_COMMAND2),
hInstance, NULL);
}
}
for (i = 0; i < 16; i++)
{
if (Tableau[i][2] == 3)
{
CreateWindow("button","3",
WS_CHILD|WS_VISIBLE|BS_DEFPUSHBUTTON,
Tableau[i][0], Tableau[i][1], 50, 50, hwnd, HMENU(ID_COMMAND3),
hInstance, NULL);
}
}
for (i = 0; i < 16; i++)
{
if (Tableau[i][2] == 4)
{
CreateWindow("button","4",
WS_CHILD|WS_VISIBLE|BS_DEFPUSHBUTTON,
Tableau[i][0], Tableau[i][1], 50, 50, hwnd, HMENU(ID_COMMAND4),
hInstance, NULL);
}
}
//Ranger 2
for (i = 0; i < 16; i++)
{
if (Tableau[i][2] == 5)
{
CreateWindow("button","5",
WS_CHILD|WS_VISIBLE|BS_DEFPUSHBUTTON,
Tableau[i][0], Tableau[i][1], 50, 50, hwnd, HMENU(ID_COMMAND5),
hInstance, NULL);
}
}
for (i = 0; i < 16; i++)
{
if (Tableau[i][2] == 6)
{
CreateWindow("button","6",
WS_CHILD|WS_VISIBLE|BS_DEFPUSHBUTTON,
Tableau[i][0], Tableau[i][1], 50, 50, hwnd, HMENU(ID_COMMAND6),
hInstance, NULL);
}
}
for (i = 0; i < 16; i++)
{
if (Tableau[i][2] == 7)
{
CreateWindow("button","7",
WS_CHILD|WS_VISIBLE|BS_DEFPUSHBUTTON,
Tableau[i][0], Tableau[i][1], 50, 50, hwnd, HMENU(ID_COMMAND7),
hInstance, NULL);
}
}
for (i = 0; i < 16; i++)
{
if (Tableau[i][2] == 8)
{
CreateWindow("button","8",
WS_CHILD|WS_VISIBLE|BS_DEFPUSHBUTTON,
Tableau[i][0], Tableau[i][1], 50, 50, hwnd, HMENU(ID_COMMAND8),
hInstance, NULL);
}
}
//Ranger 3
for (i = 0; i < 16; i++)
{
if (Tableau[i][2] == 9)
{
CreateWindow("button","9",
WS_CHILD|WS_VISIBLE|BS_DEFPUSHBUTTON,
Tableau[i][0], Tableau[i][1], 50, 50, hwnd, HMENU(ID_COMMAND9),
hInstance, NULL);
}
}
for (i = 0; i < 16; i++)
{
if (Tableau[i][2] == 10)
{
CreateWindow("button","10",
WS_CHILD|WS_VISIBLE|BS_DEFPUSHBUTTON,
Tableau[i][0], Tableau[i][1], 50, 50, hwnd, HMENU(ID_COMMAND10),
hInstance, NULL);
}
}
for (i = 0; i < 16; i++)
{
if (Tableau[i][2] == 11)
{
CreateWindow("button","11",
WS_CHILD|WS_VISIBLE|BS_DEFPUSHBUTTON,
Tableau[i][0], Tableau[i][1], 50, 50, hwnd, HMENU(ID_COMMAND11),
hInstance, NULL);
}
}
for (i = 0; i < 16; i++)
{
if (Tableau[i][2] == 12)
{
CreateWindow("button","12",
WS_CHILD|WS_VISIBLE|BS_DEFPUSHBUTTON,
Tableau[i][0], Tableau[i][1], 50, 50, hwnd, HMENU(ID_COMMAND12),
hInstance, NULL);
}
}
//Ranger 4
for (i = 0; i < 16; i++)
{
if (Tableau[i][2] == 13)
{
CreateWindow("button","13",
WS_CHILD|WS_VISIBLE|BS_DEFPUSHBUTTON,
Tableau[i][0], Tableau[i][1], 50, 50, hwnd, HMENU(ID_COMMAND13),
hInstance, NULL);
}
}
for (i = 0; i < 16; i++)
{
if (Tableau[i][2] == 14)
{
CreateWindow("button","14",
WS_CHILD|WS_VISIBLE|BS_DEFPUSHBUTTON,
Tableau[i][0], Tableau[i][1], 50, 50, hwnd, HMENU(ID_COMMAND14),
hInstance, NULL);
}
}
for (i = 0; i < 16; i++)
{
if (Tableau[i][2] == 15)
{
CreateWindow("button","15",
WS_CHILD|WS_VISIBLE|BS_DEFPUSHBUTTON,
Tableau[i][0], Tableau[i][1], 50, 50, hwnd, HMENU(ID_COMMAND15),
hInstance, NULL);
}
}
return TRUE;
}
//___________________________________________________________________________________
void Form_UnLoad (HWND hwnd)
{
PostQuitMessage (0);
}
//___________________________________________________________________________________
//******************************************************
//* Fonction qui gère tout les controle de la feuilles *
//******************************************************
void Form_OnCommand (HWND hwnd, int id, HWND hwndCtl, UINT codeNotify)
{
for (int x = 0;x < 16; x ++)
{
if(Tableau[x][2] == id)
{
if (x > 0)
if (Tableau[x - 1][2] == 0)
{
if ((x != 4) && (x != 8) && (x != 12))
{
//MessageBox(0,"Gauche","ok",MB_OK);
switch(id)
{
case 1:
MoveWindow(GetDlgItem(hwnd,ID_COMMAND1), //Le Handle du Bouton
Tableau[x - 1][0], //La Nouvelle posx
Tableau[x - 1][1], //La nouvelle posy
50,50,TRUE); //Pas de redimenssionnement
break;
case 2:
MoveWindow(GetDlgItem(hwnd,ID_COMMAND2), //Le Handle du Bouton
Tableau[x - 1][0], //La Nouvelle posx
Tableau[x - 1][1], //La nouvelle posy
50,50,TRUE); //Pas de redimenssionnement
break;
case 3:
MoveWindow(GetDlgItem(hwnd,ID_COMMAND3), //Le Handle du Bouton
Tableau[x - 1][0], //La Nouvelle posx
Tableau[x - 1][1], //La nouvelle posy
50,50,TRUE); //Pas de redimenssionnement
break;
case 4:
MoveWindow(GetDlgItem(hwnd,ID_COMMAND4), //Le Handle du Bouton
Tableau[x - 1][0], //La Nouvelle posx
Tableau[x - 1][1], //La nouvelle posy
50,50,TRUE); //Pas de redimenssionnement
break;
case 5:
MoveWindow(GetDlgItem(hwnd,ID_COMMAND5), //Le Handle du Bouton
Tableau[x - 1][0], //La Nouvelle posx
Tableau[x - 1][1], //La nouvelle posy
50,50,TRUE); //Pas de redimenssionnement
break;
case 6:
MoveWindow(GetDlgItem(hwnd,ID_COMMAND6), //Le Handle du Bouton
Tableau[x - 1][0], //La Nouvelle posx
Tableau[x - 1][1], //La nouvelle posy
50,50,TRUE); //Pas de redimenssionnement
break;
case 7:
MoveWindow(GetDlgItem(hwnd,ID_COMMAND7), //Le Handle du Bouton
Tableau[x - 1][0], //La Nouvelle posx
Tableau[x - 1][1], //La nouvelle posy
50,50,TRUE); //Pas de redimenssionnement
break;
case 8:
MoveWindow(GetDlgItem(hwnd,ID_COMMAND8), //Le Handle du Bouton
Tableau[x - 1][0], //La Nouvelle posx
Tableau[x - 1][1], //La nouvelle posy
50,50,TRUE); //Pas de redimenssionnement
break;
case 9:
MoveWindow(GetDlgItem(hwnd,ID_COMMAND9), //Le Handle du Bouton
Tableau[x - 1][0], //La Nouvelle posx
Tableau[x - 1][1], //La nouvelle posy
50,50,TRUE); //Pas de redimenssionnement
break;
case 10:
MoveWindow(GetDlgItem(hwnd,ID_COMMAND10), //Le Handle du Bouton
Tableau[x - 1][0], //La Nouvelle posx
Tableau[x - 1][1], //La nouvelle posy
50,50,TRUE); //Pas de redimenssionnement
break;
case 11:
MoveWindow(GetDlgItem(hwnd,ID_COMMAND11), //Le Handle du Bouton
Tableau[x - 1][0], //La Nouvelle posx
Tableau[x - 1][1], //La nouvelle posy
50,50,TRUE); //Pas de redimenssionnement
break;
case 12:
MoveWindow(GetDlgItem(hwnd,ID_COMMAND12), //Le Handle du Bouton
Tableau[x - 1][0], //La Nouvelle posx
Tableau[x - 1][1], //La nouvelle posy
50,50,TRUE); //Pas de redimenssionnement
break;
case 13:
MoveWindow(GetDlgItem(hwnd,ID_COMMAND13), //Le Handle du Bouton
Tableau[x - 1][0], //La Nouvelle posx
Tableau[x - 1][1], //La nouvelle posy
50,50,TRUE); //Pas de redimenssionnement
break;
case 14:
MoveWindow(GetDlgItem(hwnd,ID_COMMAND14), //Le Handle du Bouton
Tableau[x - 1][0], //La Nouvelle posx
Tableau[x - 1][1], //La nouvelle posy
50,50,TRUE); //Pas de redimenssionnement
break;
case 15:
MoveWindow(GetDlgItem(hwnd,ID_COMMAND15), //Le Handle du Bouton
Tableau[x - 1][0], //La Nouvelle posx
Tableau[x - 1][1], //La nouvelle posy
50,50,TRUE); //Pas de redimenssionnement
break;
}
//********************************
//* Changement Virtuel du Bouton *
//********************************
int Tmp2 = Tableau[x - 1][2];
Tableau[x - 1][2] = Tableau[x][2];
Tableau[x][2] = Tmp2;
return;
}
}
if (x < 15)
if (Tableau[x + 1][2] == 0)
{
if ((x != 3) && (x != 7) && (x != 11))
{
//MessageBox(0,"Droite","ok",MB_OK);
switch(id)
{
case 1:
MoveWindow(GetDlgItem(hwnd,ID_COMMAND1), //Le Handle du Bouton
Tableau[x + 1][0], //La Nouvelle posx
Tableau[x + 1][1], //La nouvelle posy
50,50,TRUE); //Pas de redimenssionnement
break;
case 2:
MoveWindow(GetDlgItem(hwnd,ID_COMMAND2), //Le Handle du Bouton
Tableau[x + 1][0], //La Nouvelle posx
Tableau[x + 1][1], //La nouvelle posy
50,50,TRUE); //Pas de redimenssionnement
break;
case 3:
MoveWindow(GetDlgItem(hwnd,ID_COMMAND3), //Le Handle du Bouton
Tableau[x + 1][0], //La Nouvelle posx
Tableau[x + 1][1], //La nouvelle posy
50,50,TRUE); //Pas de redimenssionnement
break;
case 4:
MoveWindow(GetDlgItem(hwnd,ID_COMMAND4), //Le Handle du Bouton
Tableau[x + 1][0], //La Nouvelle posx
Tableau[x + 1][1], //La nouvelle posy
50,50,TRUE); //Pas de redimenssionnement
break;
case 5:
MoveWindow(GetDlgItem(hwnd,ID_COMMAND5), //Le Handle du Bouton
Tableau[x + 1][0], //La Nouvelle posx
Tableau[x + 1][1], //La nouvelle posy
50,50,TRUE); //Pas de redimenssionnement
break;
case 6:
MoveWindow(GetDlgItem(hwnd,ID_COMMAND6), //Le Handle du Bouton
Tableau[x + 1][0], //La Nouvelle posx
Tableau[x + 1][1], //La nouvelle posy
50,50,TRUE); //Pas de redimenssionnement
break;
case 7:
MoveWindow(GetDlgItem(hwnd,ID_COMMAND7), //Le Handle du Bouton
Tableau[x + 1][0], //La Nouvelle posx
Tableau[x + 1][1], //La nouvelle posy
50,50,TRUE); //Pas de redimenssionnement
break;
case 8:
MoveWindow(GetDlgItem(hwnd,ID_COMMAND8), //Le Handle du Bouton
Tableau[x + 1][0], //La Nouvelle posx
Tableau[x + 1][1], //La nouvelle posy
50,50,TRUE); //Pas de redimenssionnement
break;
case 9:
MoveWindow(GetDlgItem(hwnd,ID_COMMAND9), //Le Handle du Bouton
Tableau[x + 1][0], //La Nouvelle posx
Tableau[x + 1][1], //La nouvelle posy
50,50,TRUE); //Pas de redimenssionnement
break;
case 10:
MoveWindow(GetDlgItem(hwnd,ID_COMMAND10), //Le Handle du Bouton
Tableau[x + 1][0], //La Nouvelle posx
Tableau[x + 1][1], //La nouvelle posy
50,50,TRUE); //Pas de redimenssionnement
break;
case 11:
MoveWindow(GetDlgItem(hwnd,ID_COMMAND11), //Le Handle du Bouton
Tableau[x + 1][0], //La Nouvelle posx
Tableau[x + 1][1], //La nouvelle posy
50,50,TRUE); //Pas de redimenssionnement
break;
case 12:
MoveWindow(GetDlgItem(hwnd,ID_COMMAND12), //Le Handle du Bouton
Tableau[x + 1][0], //La Nouvelle posx
Tableau[x + 1][1], //La nouvelle posy
50,50,TRUE); //Pas de redimenssionnement
break;
case 13:
MoveWindow(GetDlgItem(hwnd,ID_COMMAND13), //Le Handle du Bouton
Tableau[x + 1][0], //La Nouvelle posx
Tableau[x + 1][1], //La nouvelle posy
50,50,TRUE); //Pas de redimenssionnement
break;
case 14:
MoveWindow(GetDlgItem(hwnd,ID_COMMAND14), //Le Handle du Bouton
Tableau[x + 1][0], //La Nouvelle posx
Tableau[x + 1][1], //La nouvelle posy
50,50,TRUE); //Pas de redimenssionnement
break;
case 15:
MoveWindow(GetDlgItem(hwnd,ID_COMMAND15), //Le Handle du Bouton
Tableau[x + 1][0], //La Nouvelle posx
Tableau[x + 1][1], //La nouvelle posy
50,50,TRUE); //Pas de redimenssionnement
break;
}
//********************************
//* Changement Virtuel du Bouton *
//********************************
int Tmp2 = Tableau[x + 1][2];
Tableau[x + 1][2] = Tableau[x][2];
Tableau[x][2] = Tmp2;
return;
}
}
if (x < 12)
if (Tableau[x + 4][2] == 0)
{
//*********************************
//* Changement Physique du Bouton *
//*********************************
//MessageBox(0,"Haut","ok",MB_OK);
switch(id)
{
case 1:
MoveWindow(GetDlgItem(hwnd,ID_COMMAND1), //Le Handle du Bouton
Tableau[x + 4][0], //La Nouvelle posx
Tableau[x + 4][1], //La nouvelle posy
50,50,TRUE); //Pas de redimenssionnement
break;
case 2:
MoveWindow(GetDlgItem(hwnd,ID_COMMAND2), //Le Handle du Bouton
Tableau[x + 4][0], //La Nouvelle posx
Tableau[x + 4][1], //La nouvelle posy
50,50,TRUE); //Pas de redimenssionnement
break;
case 3:
MoveWindow(GetDlgItem(hwnd,ID_COMMAND3), //Le Handle du Bouton
Tableau[x + 4][0], //La Nouvelle posx
Tableau[x + 4][1], //La nouvelle posy
50,50,TRUE); //Pas de redimenssionnement
break;
case 4:
MoveWindow(GetDlgItem(hwnd,ID_COMMAND4), //Le Handle du Bouton
Tableau[x + 4][0], //La Nouvelle posx
Tableau[x + 4][1], //La nouvelle posy
50,50,TRUE); //Pas de redimenssionnement
break;
case 5:
MoveWindow(GetDlgItem(hwnd,ID_COMMAND5), //Le Handle du Bouton
Tableau[x + 4][0], //La Nouvelle posx
Tableau[x + 4][1], //La nouvelle posy
50,50,TRUE); //Pas de redimenssionnement
break;
case 6:
MoveWindow(GetDlgItem(hwnd,ID_COMMAND6), //Le Handle du Bouton
Tableau[x + 4][0], //La Nouvelle posx
Tableau[x + 4][1], //La nouvelle posy
50,50,TRUE); //Pas de redimenssionnement
break;
case 7:
MoveWindow(GetDlgItem(hwnd,ID_COMMAND7), //Le Handle du Bouton
Tableau[x + 4][0], //La Nouvelle posx
Tableau[x + 4][1], //La nouvelle posy
50,50,TRUE); //Pas de redimenssionnement
break;
case 8:
MoveWindow(GetDlgItem(hwnd,ID_COMMAND8), //Le Handle du Bouton
Tableau[x + 4][0], //La Nouvelle posx
Tableau[x + 4][1], //La nouvelle posy
50,50,TRUE); //Pas de redimenssionnement
break;
case 9:
MoveWindow(GetDlgItem(hwnd,ID_COMMAND9), //Le Handle du Bouton
Tableau[x + 4][0], //La Nouvelle posx
Tableau[x + 4][1], //La nouvelle posy
50,50,TRUE); //Pas de redimenssionnement
break;
case 10:
MoveWindow(GetDlgItem(hwnd,ID_COMMAND10), //Le Handle du Bouton
Tableau[x + 4][0], //La Nouvelle posx
Tableau[x + 4][1], //La nouvelle posy
50,50,TRUE); //Pas de redimenssionnement
break;
case 11:
MoveWindow(GetDlgItem(hwnd,ID_COMMAND11), //Le Handle du Bouton
Tableau[x + 4][0], //La Nouvelle posx
Tableau[x + 4][1], //La nouvelle posy
50,50,TRUE); //Pas de redimenssionnement
break;
case 12:
MoveWindow(GetDlgItem(hwnd,ID_COMMAND12), //Le Handle du Bouton
Tableau[x + 4][0], //La Nouvelle posx
Tableau[x + 4][1], //La nouvelle posy
50,50,TRUE); //Pas de redimenssionnement
break;
case 13:
MoveWindow(GetDlgItem(hwnd,ID_COMMAND13), //Le Handle du Bouton
Tableau[x + 4][0], //La Nouvelle posx
Tableau[x + 4][1], //La nouvelle posy
50,50,TRUE); //Pas de redimenssionnement
break;
case 14:
MoveWindow(GetDlgItem(hwnd,ID_COMMAND14), //Le Handle du Bouton
Tableau[x + 4][0], //La Nouvelle posx
Tableau[x + 4][1], //La nouvelle posy
50,50,TRUE); //Pas de redimenssionnement
break;
case 15:
MoveWindow(GetDlgItem(hwnd,ID_COMMAND15), //Le Handle du Bouton
Tableau[x + 4][0], //La Nouvelle posx
Tableau[x + 4][1], //La nouvelle posy
50,50,TRUE); //Pas de redimenssionnement
break;
}
//********************************
//* Changement Virtuel du Bouton *
//********************************
int Tmp2 = Tableau[x + 4][2];
Tableau[x + 4][2] = Tableau[x][2];
Tableau[x][2] = Tmp2;
return;
}
if (x > 3)
if (Tableau[x - 4][2] == 0)
{
//MessageBox(0,"bas","ok",MB_OK);
switch(id)
{
case 1:
MoveWindow(GetDlgItem(hwnd,ID_COMMAND1), //Le Handle du Bouton
Tableau[x - 4][0], //La Nouvelle posx
Tableau[x - 4][1], //La nouvelle posy
50,50,TRUE); //Pas de redimenssionnement
break;
case 2:
MoveWindow(GetDlgItem(hwnd,ID_COMMAND2), //Le Handle du Bouton
Tableau[x - 4][0], //La Nouvelle posx
Tableau[x - 4][1], //La nouvelle posy
50,50,TRUE); //Pas de redimenssionnement
break;
case 3:
MoveWindow(GetDlgItem(hwnd,ID_COMMAND3), //Le Handle du Bouton
Tableau[x - 4][0], //La Nouvelle posx
Tableau[x - 4][1], //La nouvelle posy
50,50,TRUE); //Pas de redimenssionnement
break;
case 4:
MoveWindow(GetDlgItem(hwnd,ID_COMMAND4), //Le Handle du Bouton
Tableau[x - 4][0], //La Nouvelle posx
Tableau[x - 4][1], //La nouvelle posy
50,50,TRUE); //Pas de redimenssionnement
break;
case 5:
MoveWindow(GetDlgItem(hwnd,ID_COMMAND5), //Le Handle du Bouton
Tableau[x - 4][0], //La Nouvelle posx
Tableau[x - 4][1], //La nouvelle posy
50,50,TRUE); //Pas de redimenssionnement
break;
case 6:
MoveWindow(GetDlgItem(hwnd,ID_COMMAND6), //Le Handle du Bouton
Tableau[x - 4][0], //La Nouvelle posx
Tableau[x - 4][1], //La nouvelle posy
50,50,TRUE); //Pas de redimenssionnement
break;
case 7:
MoveWindow(GetDlgItem(hwnd,ID_COMMAND7), //Le Handle du Bouton
Tableau[x - 4][0], //La Nouvelle posx
Tableau[x - 4][1], //La nouvelle posy
50,50,TRUE); //Pas de redimenssionnement
break;
case 8:
MoveWindow(GetDlgItem(hwnd,ID_COMMAND8), //Le Handle du Bouton
Tableau[x - 4][0], //La Nouvelle posx
Tableau[x - 4][1], //La nouvelle posy
50,50,TRUE); //Pas de redimenssionnement
break;
case 9:
MoveWindow(GetDlgItem(hwnd,ID_COMMAND9), //Le Handle du Bouton
Tableau[x - 4][0], //La Nouvelle posx
Tableau[x - 4][1], //La nouvelle posy
50,50,TRUE); //Pas de redimenssionnement
break;
case 10:
MoveWindow(GetDlgItem(hwnd,ID_COMMAND10), //Le Handle du Bouton
Tableau[x - 4][0], //La Nouvelle posx
Tableau[x - 4][1], //La nouvelle posy
50,50,TRUE); //Pas de redimenssionnement
break;
case 11:
MoveWindow(GetDlgItem(hwnd,ID_COMMAND11), //Le Handle du Bouton
Tableau[x - 4][0], //La Nouvelle posx
Tableau[x - 4][1], //La nouvelle posy
50,50,TRUE); //Pas de redimenssionnement
break;
case 12:
MoveWindow(GetDlgItem(hwnd,ID_COMMAND12), //Le Handle du Bouton
Tableau[x - 4][0], //La Nouvelle posx
Tableau[x - 4][1], //La nouvelle posy
50,50,TRUE); //Pas de redimenssionnement
break;
case 13:
MoveWindow(GetDlgItem(hwnd,ID_COMMAND13), //Le Handle du Bouton
Tableau[x - 4][0], //La Nouvelle posx
Tableau[x - 4][1], //La nouvelle posy
50,50,TRUE); //Pas de redimenssionnement
break;
case 14:
MoveWindow(GetDlgItem(hwnd,ID_COMMAND14), //Le Handle du Bouton
Tableau[x - 4][0], //La Nouvelle posx
Tableau[x - 4][1], //La nouvelle posy
50,50,TRUE); //Pas de redimenssionnement
break;
case 15:
MoveWindow(GetDlgItem(hwnd,ID_COMMAND15), //Le Handle du Bouton
Tableau[x - 4][0], //La Nouvelle posx
Tableau[x - 4][1], //La nouvelle posy
50,50,TRUE); //Pas de redimenssionnement
break;
}
//********************************
//* Changement Virtuel du Bouton *
//********************************
int Tmp2 = Tableau[x - 4][2];
Tableau[x - 4][2] = Tableau[x][2];
Tableau[x][2] = Tmp2;
return;
}
}
}
}
//___________________________________________________________________________________
Vous n'êtes pas encore membre ?
inscrivez-vous, c'est gratuit et ça prend moins d'une minute !
Les membres obtiennent plus de réponses que les utilisateurs anonymes.
Le fait d'être membre vous permet d'avoir un suivi détaillé de vos demandes et codes sources.
Le fait d'être membre vous permet d'avoir des options supplémentaires.