Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre questionVoila le code de la fenetre mere #include <windows.h> #include "resource.h" HWND hDlg; HINSTANCE hInst; BOOL CALLBACK ChildDlgProc(HWND hWnd,UINT Msg,WPARAM wParam,LPARAM lParam); BOOL CALLBACK ChildDlgProcfailure(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam); BOOL CALLBACK MainDlgProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam) { switch(Msg) { case WM_INITDIALOG: hDlg = hWnd; return 1; case WM_COMMAND: switch(LOWORD(wParam)) { case IDC_FAILURE: DialogBoxParam(hInst,MAKEINTRESOURCE(IDD_FAILUREBOX),hWnd,ChildDlgProcfailure,0); break; case IDCANCEL: EndDialog(hWnd,IDCLOSE); break; case IDC_IMAGE: DialogBoxParam(hInst,MAKEINTRESOURCE(IDD_ASSUM1),hWnd,ChildDlgProc,0); break; case IDC_CRACKSIZE: MessageBox(hDlg,"Pas encore implementé","Désolé",0); break; } } return 0; } int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd) { hInst = hInstance; return DialogBoxParam(hInstance, MAKEINTRESOURCE(IDD_MAINDLG), NULL, MainDlgProc, NULL); } Voila le code de la fenetre fille qui sert a calculer #include <windows.h> #include "resource.h" #include<math.h> #define Pi 3.1415926 HWND hChildDlgfailure; HINSTANCE hInstfailure; HWND hWnd; double * young = new double ; double * poisson = new double; double * toughness = new double ; double * thickness = new double; double * length = new double ; double * loading = new double ; long double * Kic = new long double ; long double * Gic = new long double ; long double * q =new long double; double * s =new double; long double y=0; long double p=0; double l=0; double lo=0; double k=0; double g=0; double thick=0; double tough=0; BOOL CALLBACK ChildDlgProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam); BOOL CALLBACK ChildDlgProcfailure(HWND hWndfailure, UINT Msg, WPARAM wParam, LPARAM lParam) { switch(Msg) { case WM_INITDIALOG: hChildDlgfailure = hWndfailure; SetDlgItemInt(hWndfailure,EDITLOADING,1,TRUE); SetDlgItemInt(hWndfailure,EDITPOISSON,1,TRUE); SetDlgItemInt(hWndfailure,EDITLENGTHCRACK,1,TRUE); SetDlgItemInt(hWndfailure,EDITTHICKNESS,1,TRUE); SetDlgItemInt(hWndfailure,EDITLOADING,1,TRUE); SetDlgItemInt(hWndfailure,EDITKIC,1,TRUE); SetDlgItemInt(hWndfailure,EDITGIC,0,TRUE); SetDlgItemInt(hWndfailure,EDITYOUNG,1,TRUE); return 1; case WM_COMMAND: switch(LOWORD(wParam)) { case IDC_AFFICHE: DialogBoxParam(hInstfailure,MAKEINTRESOURCE(IDD_ASSUM1),hWndfailure,ChildDlgProc,NULL); //Cet appel fonctionne mal, la dialogbox se charge mais l'image qui est censée s'afficher dessus non. case IDC_ASSUM1: *length=GetDlgItemInt(hWndfailure,EDITLENGTHCRACK,NULL,TRUE); *loading=GetDlgItemInt(hWndfailure,EDITLOADING,NULL,TRUE); *young=GetDlgItemInt(hWndfailure,EDITYOUNG,NULL,TRUE); *poisson=GetDlgItemInt(hWndfailure,EDITPOISSON,NULL,TRUE); l=*length; lo=*loading; y=*young; *q=Pi*l*0.001; k=lo*sqrt(*q); *q=4*y*(k)*1000000; *s=3-(*poisson); g=((*s)/(*q)); SetDlgItemInt(hWndfailure,EDITKIC,k,TRUE); SetDlgItemInt(hWndfailure,EDITGIC,g,TRUE); DialogBoxParam(hInstfailure,MAKEINTRESOURCE(IDD_ASSUM1),hWndfailure,ChildDlgProc,NULL); break; case IDC_ASSUM2: *length=GetDlgItemInt(hWndfailure,EDITLENGTHCRACK,NULL,TRUE); *loading=GetDlgItemInt(hWndfailure,EDITLOADING,NULL,TRUE); *young=GetDlgItemInt(hWndfailure,EDITYOUNG,NULL,TRUE); *poisson=GetDlgItemInt(hWndfailure,EDITPOISSON,NULL,TRUE); *thickness=GetDlgItemInt(hWndfailure,EDITTHICKNESS,NULL,TRUE); l=*length; lo=*loading; p=*poisson; y=*young; thick=*thickness; *q=Pi*l*0.001; thick=2*thick*0.001; *s=cos(*q/thick); k=(lo*sqrt(*q))/(sqrt(*s)); *Kic=k; g=((3-p)/(4*y*1000000))*k; SetDlgItemInt(hWndfailure,EDITKIC,k,TRUE); SetDlgItemInt(hWndfailure,EDITGIC,g,TRUE); DialogBoxParam(hInstfailure,MAKEINTRESOURCE(IDD_ASSUM2),hWndfailure,ChildDlgProc,NULL); break; case IDC_ASSUM3: DialogBoxParam(hInstfailure,MAKEINTRESOURCE(IDD_ASSUM3),hWndfailure,ChildDlgProc,NULL); break; case ID_CLOSE: EndDialog(hWndfailure,IDCLOSE); break; } break; } return 0; } Voila le code de la fentre fille qui affiche l'image (enfin qui gere la dialog box contenant l'image...) #include <windows.h> #include "resource.h" HWND hChildDlg; BOOL CALLBACK ChildDlgProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam) { switch(Msg) { case WM_INITDIALOG: hChildDlg = hWnd; return 1; case WM_COMMAND: switch(LOWORD(wParam)) { case IDC_CLOSE: EndDialog(hWnd,IDOK); break; } break; } return 0; }