| 12
 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
 
 | #include <windows.h>
#include "resource.h"
 
// Prototype de notre fonction
LRESULT CALLBACK MainProc(HWND Dlg,UINT message,WPARAM wParam,LPARAM lParam);
 
// Rien de spécial ici
int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine,int nCmdShow)
{
 	DialogBox(hInstance,(LPCTSTR)IDD_DIALOG1,NULL,(DLGPROC)MainProc);
	return 0;
}
 
// Procédure de gestion de la boite de dialogue
LRESULT CALLBACK MainProc(HWND Dlg,UINT message,WPARAM wParam,LPARAM lParam)
{
	int Select, iLine;
	char *buf="";
	static HWND hEdit;
 
	switch(message)
	{
		case WM_COMMAND:
 
			Select=LOWORD(wParam);
			BOOL fError; 
			BOOL fRelative;
 
			fRelative = TRUE; 
 
			switch(Select)
			{
				case IDOK:
                    iLine = GetDlgItemInt(Dlg,IDC_EDIT1, &fError, fRelative); 
					hEdit = GetDlgItem(Dlg, IDC_EDIT1);
 
					if (iLine)
					{
						int len = GetWindowTextLength(hEdit); 
						char * buff = new char[len+1]; 
						GetWindowText(hEdit, buff, len+1); 
 
						MessageBox(Dlg, buff, " Calcule", MB_OK); 
					}
					// total = ((cn*f)/200);
				return TRUE;
 
				case IDCANCEL:
					EndDialog(Dlg,Select);
				return TRUE;
			}
		default:
		return FALSE;
	}
} | 
Partager