INT_PTR CALLBACK inputParaProc(HWND hwndDlg,UINT message,WPARAM wParam,LPARAM lParam) { switch (message) { case WM_INITDIALOG: SetDlgItemInt(hwndDlg,IDC_INPUTPARA_PERIOD,m_Period,TRUE); SetDlgItemInt(hwndDlg,IDC_INPUTPARA_AMPLITUDE,m_Amplitude,TRUE); SetDlgItemInt(hwndDlg,IDC_INPUTPARA_SAMPFREQ,m_SampleFreq,TRUE); return TRUE; case WM_COMMAND: switch (LOWORD(wParam)) { case IDOK: { BOOL Translated; MinMaxInt(hwndDlg,GetDlgItemInt(hwndDlg,IDC_INPUTPARA_PERIOD,NULL,TRUE), 4,320,m_Period,Translated); MinMaxInt(hwndDlg,GetDlgItemInt(hwndDlg,IDC_INPUTPARA_AMPLITUDE,NULL,TRUE), 1,5,m_Amplitude,Translated); MinMaxInt(hwndDlg,GetDlgItemInt(hwndDlg,IDC_INPUTPARA_SAMPFREQ,NULL,TRUE), 1,159,m_SampleFreq,Translated); if(!Translated) return FALSE; n_mCoordMode=SINSIGNAL_INPUT; InvalidateRgn(GetParent(hwndDlg),NULL,TRUE); } case IDCANCEL: EndDialog(hwndDlg,0); return TRUE; } } return FALSE; }
INT_PTR CALLBACK DftParaProc(HWND hwndDlg,UINT message,WPARAM wParam,LPARAM lParam) { switch (message) { case WM_INITDIALOG: SetDlgItemInt(hwndDlg,IDC_DFT_POINT,m_dft_point,TRUE); SetDlgItemInt(hwndDlg,IDC_TRI_AMPLITUDE,m_tri_amplitude,TRUE); SetDlgItemInt(hwndDlg,IDC_TRI_PIEROD,m_tri_pierod,TRUE); SetDlgItemInt(hwndDlg,IDC_TRI_COUNT,m_tri_count,TRUE); return TRUE; case WM_COMMAND: switch (LOWORD(wParam)) { case IDOK: { BOOL Translated; MinMaxInt(hwndDlg,GetDlgItemInt(hwndDlg,IDC_DFT_POINT,NULL,TRUE), 1,160,m_dft_point,Translated); MinMaxInt(hwndDlg,GetDlgItemInt(hwndDlg,IDC_TRI_AMPLITUDE,NULL,TRUE), 1,5,m_tri_amplitude,Translated); MinMaxInt(hwndDlg,GetDlgItemInt(hwndDlg,IDC_TRI_PIEROD,NULL,TRUE), 1,160,m_tri_pierod,Translated); MinMaxInt(hwndDlg,GetDlgItemInt(hwndDlg,IDC_TRI_COUNT,NULL,TRUE), 1,5,m_tri_count,Translated); if(!Translated) return FALSE; n_mCoordMode=DFT_TRI; InvalidateRgn(GetParent(hwndDlg),NULL,TRUE); } case IDCANCEL: EndDialog(hwndDlg,0); return TRUE; } } return FALSE; }
INT_PTR CALLBACK filterTriProc(HWND hwndDlg,UINT message,WPARAM wParam,LPARAM lParam) { switch (message) { case WM_INITDIALOG: SetDlgItemInt(hwndDlg,IDC_FILTER_SIGNAL_AM,n_filter_signal_am,TRUE); SetDlgItemInt(hwndDlg,IDC_FILTER_SIGNAL_FREQ,n_filter_signal_freq,TRUE); SetDlgItemInt(hwndDlg,IDC_FILTER_CARRIER_AM,n_filter_carrier_am,TRUE); SetDlgItemInt(hwndDlg,IDC_FILTER_CARRIER_FREQ,n_filter_carrier_freq,TRUE); return TRUE; case WM_COMMAND: switch (LOWORD(wParam)) { case IDOK: { BOOL Translated; MinMaxInt(hwndDlg,GetDlgItemInt(hwndDlg,IDC_FILTER_SIGNAL_AM,NULL,TRUE), 0,5,n_filter_signal_am,Translated); MinMaxInt(hwndDlg,GetDlgItemInt(hwndDlg,IDC_FILTER_SIGNAL_FREQ,NULL,TRUE), 1,500,n_filter_signal_freq,Translated); MinMaxInt(hwndDlg,GetDlgItemInt(hwndDlg,IDC_FILTER_CARRIER_AM,NULL,TRUE), 0,5,n_filter_carrier_am,Translated); MinMaxInt(hwndDlg,GetDlgItemInt(hwndDlg,IDC_FILTER_CARRIER_FREQ,NULL,TRUE), 0,1000,n_filter_carrier_freq,Translated); if(!Translated) return FALSE; n_mCoordMode=FILTER_TRI; InvalidateRgn(GetParent(hwndDlg),NULL,TRUE); } case IDCANCEL: EndDialog(hwndDlg,0); return TRUE; } } return FALSE; }
int main(){ int test[256]; int i=0; int *output; while((i<256)&& (scanf("%d",&test[i++])==1)); output = MinMaxInt(test,i); printf("Min=%d , Max=%d\n",output[0],output[1]); }