00001
00002
00003
00004 #include <windows.h>
00005 #include "windlg.h"
00006 #include "dlgproc.h"
00007 #include "nmlperf.hh"
00008 #include "nmlperf.rh"
00009 #include "win_prnt.hh"
00010 #include "rcs_prnt.hh"
00011
00012 BOOL handle_command (HWND hwndDlg, long id, HWND hwndCtl, long wNotifyCode);
00013 HWND rcs_print_window;
00014
00015 static char config_file[256];
00016 static char hostname[256];
00017 static DISPLAY_MODE display_mode;
00018 static int detailed_output;
00019 static int iterations;
00020 static int increments;
00021 static int master;
00022 static int check_match;
00023
00024 BOOL CALLBACK
00025 main_window_dialog_proc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
00026 {
00027 long idItem;
00028 HWND hwndCtl;
00029 long wNotifyCode;
00030 switch (msg)
00031 {
00032 case WM_INITDIALOG:
00033 display_mode = BYTES_PER_SEC_MODE;
00034 detailed_output = 0;
00035 CheckDlgButton (hwndDlg, IDC_BPS_DISPLAY_RADIO, 1);
00036 CheckDlgButton (hwndDlg, IDC_DETAILED_OUT_CHECKBOX, 0);
00037 rcs_print_window =
00038 create_rcs_print_window (hWinDlgInstance, SW_SHOW, NULL);
00039 rcs_print ("NMLPERF For Windows.\n");
00040 SetActiveWindow (hwndDlg);
00041 break;
00042
00043 case WM_COMMAND:
00044 idItem = wParam;
00045 hwndCtl = (HWND) LOWORD (lParam);
00046 wNotifyCode = HIWORD (lParam);
00047 return handle_command (hwndDlg, idItem, hwndCtl, wNotifyCode);
00048 case WM_SYSCOMMAND:
00049 switch (wParam)
00050 {
00051 case SC_CLOSE:
00052 WinDlgExit ();
00053 return 1;
00054 default:
00055 return 0;
00056 }
00057
00058 default:
00059 return 0;
00060 }
00061 return 0;
00062 }
00063
00064
00065 BOOL
00066 handle_command (HWND hwndDlg, long id, HWND hwndCtl, long wNotifyCode)
00067 {
00068 BOOL error_flag;
00069
00070 switch (id)
00071 {
00072 case IDC_START_BUTTON:
00073 GetDlgItemText (hwndDlg, IDC_CONFIG_FILE_EDIT, config_file, 256);
00074 GetDlgItemText (hwndDlg, IDC_HOSTNAME_EDIT, hostname, 256);
00075 iterations =
00076 GetDlgItemInt (hwndDlg, IDC_ITERATIONS_EDIT, &error_flag, FALSE);
00077 increments =
00078 GetDlgItemInt (hwndDlg, IDC_INCREMENTS_EDIT, &error_flag, FALSE);
00079 detailed_output =
00080 IsDlgButtonChecked (hwndDlg, IDC_DETAILED_OUT_CHECKBOX);
00081 master = IsDlgButtonChecked (hwndDlg, IDC_MASTER_CHECKBOX);
00082 check_match = IsDlgButtonChecked (hwndDlg, IDC_CHECKMATCH_CHECKBOX);
00083 EnableWindow (GetDlgItem (hwndDlg, IDC_STOP_BUTTON), TRUE);
00084 EnableWindow (GetDlgItem (hwndDlg, IDC_START_BUTTON), FALSE);
00085 SetActiveWindow (rcs_print_window);
00086 nmlperf (config_file, hostname, master, iterations, increments,
00087 detailed_output, display_mode, 0, check_match, 10000);
00088 EnableWindow (GetDlgItem (hwndDlg, IDC_START_BUTTON), TRUE);
00089 EnableWindow (GetDlgItem (hwndDlg, IDC_STOP_BUTTON), FALSE);
00090 SetActiveWindow (hwndDlg);
00091 return 1;
00092
00093 case IDC_STOP_BUTTON:
00094 nmlperf_stop ();
00095 return 1;
00096
00097 case IDC_BPS_DISPLAY_RADIO:
00098 display_mode = BYTES_PER_SEC_MODE;
00099 break;
00100
00101 case IDC_MPS_DISPLAY_RADIO:
00102 display_mode = MSG_PER_SEC_MODE;
00103 break;
00104 default:
00105 return 0;
00106 }
00107 return (0);
00108 }