1.6 case WM_CLOSE: |
2.6 EndDialog(hwnd, nResult); |
3.6 break; |
4.6 case WM_COMMAND: |
5.6 double kVy, W0; |
6.6 switch(LOWORD(wParam)) |
7.6 case IDB_NewParticle: |
8.6 GetDlgItemText(hwnd,IDC_EDIT_W0,buffer,sizeof(buffer)); |
9.6 W0 = atof(buffer); |
10.6 GetDlgItemText(hwnd, IDC_EDIT_kVy, buffer, sizeof(buffer)); |
11.6 kVy = atof(buffer); |
12.6 vpp.push_back(Particle(W0, kVy)); |
13.6 sprintf_s(buffer, "%d", vpp.size()); |
14.6 SetDlgItemText(hwnd, IDC_EDIT_PartNum, buffer); |
15.6 break; |
16.6 case IDB_Confirm: //the button “Confirm” is pressed |
17.6 if(vpp.empty()) break; |
18.6 particleModelessBox = GetDlgItemInt(hwnd, |
19.6 IDC_EDIT_ParticleModelessBox, NULL, FALSE); |
20.6 if(particleModelessBox >= (signed)vpp.size()) |
21.6 particleModelessBox = vpp.size() - 1; |
22.6 if(particleListBox == -1 ) |
23.6 particleListBox = particleModelessBox; |
24.6 InvalidateRect(hwnd, NULL, FALSE); |
25.6 |
26.6 break; |
27.6 case IDB_Run: //the button “Run” is pressed |
28.6 if(pause == true) |
29.6 ResumeThread(hThread); |
30.6 pause = false; |
31.6 |
32.6 break; |
33.6 case IDB_Pause: //the button “Pause” is pressed |
34.6 if(pause == false) |
35.6 SuspendThread(hThread); |
36.6 pause = true; |
37.6 |
38.6 break; |
39.6 case IDB_Cancel: //the button “Cancel” is pressed |
40.6 EndDialog(hwnd, nResult); |
41.6 break; |
42.6 |
43.6 break; |
44.6 case WM_HSCROLL: |
45.6 sleep = SendMessage(GetDlgItem(hwnd, IDC_Trackbar), |
46.6 TBM_GETPOS, 0, 0); |
47.6 sprintf_s(buffer, "%3d", sleep); |
48.6 SetDlgItemText(hwnd, IDC_EDIT_Sleep, buffer); |
49.6 break; |
50.6 case WM_PAINT: |
51.6 hDC = BeginPaint(hwnd, &psPaint); |
52.6 GetClientRect(hwnd, &rect); |
53.6 SetMapMode(hDC, MM_ISOTROPIC); |
54.6 SetWindowExtEx(hDC, zW, yW, NULL); |
55.6 SetViewportExtEx(hDC, rect.right, rect.bottom, NULL); |