1*c2c66affSColin Finck #include "DefragDialog.h" 2*c2c66affSColin Finck #include "Defragment.h" 3*c2c66affSColin Finck #include "resource.h" 4*c2c66affSColin Finck 5*c2c66affSColin Finck 6*c2c66affSColin Finck void UpdateDefragInfo (HWND Dlg) 7*c2c66affSColin Finck { 8*c2c66affSColin Finck Defragment *Defrag; 9*c2c66affSColin Finck HWND PercentItem; 10*c2c66affSColin Finck char PercentText[100]; 11*c2c66affSColin Finck 12*c2c66affSColin Finck Defrag = (Defragment *) GetWindowLongPtr (Dlg, GWLP_USERDATA); 13*c2c66affSColin Finck 14*c2c66affSColin Finck sprintf (PercentText, "%6.2f%%", Defrag->GetStatusPercent()); 15*c2c66affSColin Finck PercentItem = GetDlgItem (Dlg, IDC_PERCENT); 16*c2c66affSColin Finck SendMessage (GetDlgItem (Dlg, IDC_PERCENT), WM_SETTEXT, 0, (LPARAM) PercentText); 17*c2c66affSColin Finck SendMessage (GetDlgItem (Dlg, IDC_STATUS_TEXT), WM_SETTEXT, 0, (LPARAM) Defrag->GetStatusString().c_str()); 18*c2c66affSColin Finck 19*c2c66affSColin Finck return; 20*c2c66affSColin Finck } 21*c2c66affSColin Finck 22*c2c66affSColin Finck 23*c2c66affSColin Finck INT_PTR CALLBACK DefragDialogProc (HWND Dlg, UINT Msg, WPARAM WParam, LPARAM LParam) 24*c2c66affSColin Finck { 25*c2c66affSColin Finck switch (Msg) 26*c2c66affSColin Finck { 27*c2c66affSColin Finck case WM_INITDIALOG: 28*c2c66affSColin Finck SetWindowLongPtr (Dlg, GWLP_USERDATA, (LONG_PTR)LParam); 29*c2c66affSColin Finck UpdateDefragInfo (Dlg); 30*c2c66affSColin Finck return (1); 31*c2c66affSColin Finck 32*c2c66affSColin Finck case WM_UPDATEINFO: 33*c2c66affSColin Finck UpdateDefragInfo (Dlg); 34*c2c66affSColin Finck return (1); 35*c2c66affSColin Finck } 36*c2c66affSColin Finck 37*c2c66affSColin Finck return (0); 38*c2c66affSColin Finck } 39