| 1.3 #include<windows.h> |
| 2.3 #include<iostream> |
| 3.3 #include"resource.h" |
| 4.3 #include"particle.h" |
| 5.3 #include"field.h" |
| 6.3 #include<CommCtrl.h> |
| 7.3 #pragma comment(lib, "comctl32.lib") |
| 8.3 using namespace std; |
| 9.3 |
| 10.3 HWND hModalDlg, hModelessDlg = 0; |
| 11.3 INT_PTR nResult; |
| 12.3 HANDLE hThread; |
| 13.3 bool pause = true; // a control to make the pause in execution |
| 14.3 int sleep = 0; //a control affecting the rate of running |
| 15.3 const double my = 200./0.06, mz = my, kzy = 0.004; |
| 16.3 const int height = 200, height2 = (int)(height*0.5), |
| 17.3 width=(int)(height*28./15.); |
| 18.3 const int zLeft = 80, yTop = 70; //coordinates of the drawing area |
| 19.3 vector<Particle> vpp; //container keeping the set of particles |
| 20.3 int particleModelessBox = -1; |
| 21.3 int particleListBox = -1; |
| 22.3 char bufListBox180; |
| 23.3 |
| 24.3 int CALLBACK ModalDlgProc(HWND, UINT, WPARAM, LPARAM); |
| 25.3 int CALLBACK ModelessDlgProc(HWND, UINT, WPARAM, LPARAM); |
| 26.3 DWORD CALLBACK ThreadProc(LPVOID); |
| 27.3 void DrawEquipotentialLines(HDC, HFONT, LOGFONT, HPEN, Field*); |
| 28.3 |
| 29.3 int WINAPI WinMain(HINSTANCE hI, HINSTANCE hI2, LPSTR p, int n) |
| 30.3 MSG msg; |
| 31.3 Particle::pF = new Field(); |
| 32.3 nResult = DialogBox(NULL, "MYDIALOG", 0, (DLGPROC)ModalDlgProc); |
| 33.3 while(GetMessage(&msg, NULL, 0, 0) > 0) |
| 34.3 if(hModelessDlg == 0 || !IsDialogMessage(hModelessDialog, &msg)) |
| 35.3 TranslateMessage(&msg); |
| 36.3 DispatchMessage(&msg); |
| 37.3 |
| 38.3 |
| 39.3 delete Particle::pF; |
| 40.3 return msg.wParam; |
| 41.3 |