Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre question#include <fstream> #include #include <conio.h> #include <windows.h> #include <stdio.h> #include <mmsystem.h> #pragma comment (lib,"winmm.lib") //librairie => playsound #include "resource.h" using namespace std; int new_nb=0,old_nb=0; LRESULT CALLBACK MainProc(HWND Dlg,UINT mssg,WPARAM wParam,LPARAM lParam); int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { while(1){ DialogBox(hInstance,MAKEINTRESOURCE(IDD_DIALOG1),0,(DLGPROC)MainProc); /* HWND hDlg; hDlg=CreateDialog(hInstance,(LPCTSTR)IDD_DIALOG1,NULL,(DLGPROC)MainProc); ShowWindow(hDlg,SW_SHOW); MSG msg; while(GetMessage(&msg,hDlg,0,0)==TRUE) { TranslateMessage(&msg); DispatchMessage(&msg); */ } return 0; } LRESULT CALLBACK MainProc(HWND Dlg,UINT message,WPARAM wParam,LPARAM lParam) { int Select; HANDLE hd; WIN32_FIND_DATA w32hd; int nb=0; //nombre de fichiers *.hd char leshd[256] = "*.hd"; //tableau stockant les fichiers *.hd //prendre le 1er fichier hd = FindFirstFile ( leshd, &w32hd ); //si il y a un autre fichier recommencer l'operation while (FindNextFile( hd, &w32hd)) nb++; //si il y a des fichier avec l'extension .hd if (hd!=INVALID_HANDLE_VALUE) new_nb = nb; //affichage du message switch(message) { case WM_INITDIALOG: //si la nouvelle valeur de nb est différente de l'ancienne valeur (+ de .hd) if (new_nb >> old_nb){ SetClassLong(Dlg, GCL_HICON, (long)LoadIcon(0, IDI_APPLICATION)); } else EndDialog(Dlg,0); return 1; case WM_COMMAND: Select=LOWORD(wParam); switch(Select) { case IDOK: EndDialog(Dlg,0); PostQuitMessage(0); return TRUE; } break; default: return FALSE; } Sleep(10000); //mise à jour de nb old_nb = new_nb; }
int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { while(1){ DialogBox(hInstance,MAKEINTRESOURCE(IDD_DIALOG1),0,(DLGPROC)MainProc); /* HWND hDlg; hDlg=CreateDialog(hInstance,(LPCTSTR)IDD_DIALOG1,NULL,(DLGPROC)MainProc); ShowWindow(hDlg,SW_SHOW); MSG msg; while(GetMessage(&msg,hDlg,0,0)==TRUE) { TranslateMessage(&msg); DispatchMessage(&msg); */ }
int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { DialogBox(hInst, MAKEINTRESOURCE(IDD_DIALOG1), 0, (DLGPROC)MainProc); return 0; }
WM_INITDIALOG: instructions... break;