📄 dipattn.c
字号:
if(IsDlgButtonChecked(hDlg, IDC_CMatch6))
{ EnableWindow(GetDlgItem(hDlg,IDC_ED_Match6),TRUE);
SetFocus(GetDlgItem(hDlg,IDC_ED_Match6));}
else
EnableWindow(GetDlgItem(hDlg,IDC_ED_Match6),FALSE);
break;
case IDC_CMatch7:
if(IsDlgButtonChecked(hDlg, IDC_CMatch7))
{ EnableWindow(GetDlgItem(hDlg,IDC_ED_Match7),TRUE);
SetFocus(GetDlgItem(hDlg,IDC_ED_Match7));}
else
EnableWindow(GetDlgItem(hDlg,IDC_ED_Match7),FALSE);
break;
case IDOK :
usCEnable=0; usCMatchEnable=0; usTrigEdge=0; usCOverflow=0;
for(i=0;i<8;i++)
if(IsDlgButtonChecked(hDlg, (IDC_Counter0+i)))
{
usCEnable |= (0x01 << i);
GetDlgItemText(hDlg,(IDC_EDPeValue0+i),szBuffer,40);
usCPreset[i] = LOWORD(atol(szBuffer));
if(IsDlgButtonChecked(hDlg, (IDC_CMatch0+i)))
{
usCMatchEnable |= (0x01 << i);
GetDlgItemText(hDlg,(IDC_ED_Match0+i),szBuffer,40);
usCMatchValue[i] = LOWORD(atol(szBuffer));
}
else
usCMatchValue[i] = 0;
if(IsDlgButtonChecked(hDlg, (IDC_COverflow0+i)))
usCOverflow |= (0x01 << i);
if(IsDlgButtonChecked(hDlg, (IDC_CTrigFedge0 + i)))
usTrigEdge |= (0x01 << i);
}
else
{
usCPreset[i] = 0;
usCMatchValue[i] = 0;
}
case IDCANCEL :
EndDialog(hDlg, 0);
return TRUE;
}
break;
}
return FALSE ;
}
/***************************************************************************
FUNCTION: ConfigPatternProc(HWND, unsigned, WPARAM, LPARAM)
PURPOSE: Processes dialog box messages for scan time settings
****************************************************************************/
BOOL FTYPE ConfigPatternProc
(
HWND hDlg, // window handle
unsigned message, // type of message
WPARAM wParam, // additional information
LPARAM lParam // additional information
)
{
USHORT i;
switch (message)
{
case WM_INITDIALOG :
for(i=0; i<8; i++)
{
EnableWindow(GetDlgItem(hDlg,(IDC_Pattern0 + i)),TRUE);
if(usPEnable & (0x01 << i))
{
CheckDlgButton(hDlg,(IDC_Pattern0 + i),TRUE);
EnableWindow(GetDlgItem(hDlg,IDC_PB0HI + i),TRUE);
EnableWindow(GetDlgItem(hDlg,IDC_PB0LOW + i),TRUE);
if(usPValue & (0x01 << i))
CheckDlgButton(hDlg,(IDC_PB0HI + i),1);
else
CheckDlgButton(hDlg,(IDC_PB0LOW + i),1);
} else {
CheckDlgButton(hDlg,(IDC_Pattern0 + i),FALSE);
EnableWindow(GetDlgItem(hDlg,IDC_PB0HI + i),FALSE);
EnableWindow(GetDlgItem(hDlg,IDC_PB0LOW + i),FALSE);
}
}
return TRUE;
case WM_COMMAND :
switch (LOWORD(wParam))
{
case IDC_Pattern0:
if(IsDlgButtonChecked(hDlg, IDC_Pattern0))
{ EnableWindow(GetDlgItem(hDlg,IDC_PB0HI ),TRUE);
EnableWindow(GetDlgItem(hDlg,IDC_PB0LOW),TRUE);
CheckDlgButton(hDlg,IDC_PB0HI,TRUE);
CheckDlgButton(hDlg,IDC_PB0LOW,FALSE);
}
else
{ EnableWindow(GetDlgItem(hDlg,IDC_PB0HI ),FALSE);
EnableWindow(GetDlgItem(hDlg,IDC_PB0LOW),FALSE);}
break;
case IDC_Pattern1:
if(IsDlgButtonChecked(hDlg, IDC_Pattern1))
{ EnableWindow(GetDlgItem(hDlg,IDC_PB1HI ),TRUE);
EnableWindow(GetDlgItem(hDlg,IDC_PB1LOW),TRUE);
CheckDlgButton(hDlg,IDC_PB1HI,TRUE);
CheckDlgButton(hDlg,IDC_PB1LOW,FALSE);
}
else
{ EnableWindow(GetDlgItem(hDlg,IDC_PB1HI ),FALSE);
EnableWindow(GetDlgItem(hDlg,IDC_PB1LOW),FALSE);}
break;
case IDC_Pattern2:
if(IsDlgButtonChecked(hDlg, IDC_Pattern2))
{ EnableWindow(GetDlgItem(hDlg,IDC_PB2HI ),TRUE);
EnableWindow(GetDlgItem(hDlg,IDC_PB2LOW),TRUE);
CheckDlgButton(hDlg,IDC_PB2HI,TRUE);
CheckDlgButton(hDlg,IDC_PB2LOW,FALSE);
}
else
{ EnableWindow(GetDlgItem(hDlg,IDC_PB2HI ),FALSE);
EnableWindow(GetDlgItem(hDlg,IDC_PB2LOW),FALSE);}
break;
case IDC_Pattern3:
if(IsDlgButtonChecked(hDlg, IDC_Pattern3))
{ EnableWindow(GetDlgItem(hDlg,IDC_PB3HI ),TRUE);
EnableWindow(GetDlgItem(hDlg,IDC_PB3LOW),TRUE);
CheckDlgButton(hDlg,IDC_PB3HI,TRUE);
CheckDlgButton(hDlg,IDC_PB3LOW,FALSE);
}
else
{ EnableWindow(GetDlgItem(hDlg,IDC_PB3HI ),FALSE);
EnableWindow(GetDlgItem(hDlg,IDC_PB3LOW),FALSE);}
break;
case IDC_Pattern4:
if(IsDlgButtonChecked(hDlg, IDC_Pattern4))
{ EnableWindow(GetDlgItem(hDlg,IDC_PB4HI ),TRUE);
EnableWindow(GetDlgItem(hDlg,IDC_PB4LOW),TRUE);
CheckDlgButton(hDlg,IDC_PB4HI,TRUE);
CheckDlgButton(hDlg,IDC_PB4LOW,FALSE);
}
else
{ EnableWindow(GetDlgItem(hDlg,IDC_PB4HI ),FALSE);
EnableWindow(GetDlgItem(hDlg,IDC_PB4LOW),FALSE);}
break;
case IDC_Pattern5:
if(IsDlgButtonChecked(hDlg, IDC_Pattern5))
{ EnableWindow(GetDlgItem(hDlg,IDC_PB5HI ),TRUE);
EnableWindow(GetDlgItem(hDlg,IDC_PB5LOW),TRUE);
CheckDlgButton(hDlg,IDC_PB5HI,TRUE);
CheckDlgButton(hDlg,IDC_PB5LOW,FALSE);
}
else
{ EnableWindow(GetDlgItem(hDlg,IDC_PB5HI ),FALSE);
EnableWindow(GetDlgItem(hDlg,IDC_PB5LOW),FALSE);}
break;
case IDC_Pattern6:
if(IsDlgButtonChecked(hDlg, IDC_Pattern6))
{ EnableWindow(GetDlgItem(hDlg,IDC_PB6HI ),TRUE);
EnableWindow(GetDlgItem(hDlg,IDC_PB6LOW),TRUE);
CheckDlgButton(hDlg,IDC_PB6HI,TRUE);
CheckDlgButton(hDlg,IDC_PB6LOW,FALSE);
}
else
{ EnableWindow(GetDlgItem(hDlg,IDC_PB6HI ),FALSE);
EnableWindow(GetDlgItem(hDlg,IDC_PB6LOW),FALSE);}
break;
case IDC_Pattern7:
if(IsDlgButtonChecked(hDlg, IDC_Pattern7))
{ EnableWindow(GetDlgItem(hDlg,IDC_PB7HI ),TRUE);
EnableWindow(GetDlgItem(hDlg,IDC_PB7LOW),TRUE);
CheckDlgButton(hDlg,IDC_PB7HI,TRUE);
CheckDlgButton(hDlg,IDC_PB7LOW,FALSE);
}
else
{ EnableWindow(GetDlgItem(hDlg,IDC_PB7HI ),FALSE);
EnableWindow(GetDlgItem(hDlg,IDC_PB7LOW),FALSE);}
break;
case IDOK :
usPEnable = 0;
usPValue = 0;
for(i=0; i<8; i++)
if(IsDlgButtonChecked(hDlg,IDC_Pattern0 + i))
{
usPEnable |= (0x01 << i);
if(IsDlgButtonChecked(hDlg,IDC_PB0HI + i))
usPValue |= (0x01 << i);
}
case IDCANCEL :
EndDialog(hDlg, 0);
return TRUE;
}
break;
}
return FALSE ;
}
/***************************************************************************
FUNCTION: ConfigStatusProc(HWND, unsigned, WPARAM, LPARAM)
PURPOSE: Processes dialog box messages for scan time settings
****************************************************************************/
BOOL FTYPE ConfigStatusProc
(
HWND hDlg, // window handle
unsigned message, // type of message
WPARAM wParam, // additional information
LPARAM lParam // additional information
)
{
USHORT i;
switch (message)
{
case WM_INITDIALOG :
for(i=0; i<8; i++)
{
// if(usFEnable & (0x01 << i))
// {
EnableWindow(GetDlgItem(hDlg,(IDC_Status0 + i)),TRUE);
if(usSEnable & (0x01 << i))
{
CheckDlgButton(hDlg,(IDC_Status0 + i),TRUE);
EnableWindow(GetDlgItem(hDlg,(IDC_SRiseTrig0+i)),TRUE);
EnableWindow(GetDlgItem(hDlg,(IDC_SFallTrig0+i)),TRUE);
if(usSRiseEdge & (0x01 << i))
CheckDlgButton(hDlg,(IDC_SRiseTrig0 + i),TRUE);
else
CheckDlgButton(hDlg,(IDC_SRiseTrig0 + i),FALSE);
if(usSFallEdge & (0x01 << i))
CheckDlgButton(hDlg,(IDC_SFallTrig0 + i),TRUE);
else
CheckDlgButton(hDlg,(IDC_SFallTrig0 + i),FALSE);
}
else
{
CheckDlgButton(hDlg,(IDC_Status0 + i),FALSE);
EnableWindow(GetDlgItem(hDlg,(IDC_SRiseTrig0+i)),FALSE);
EnableWindow(GetDlgItem(hDlg,(IDC_SFallTrig0+i)),FALSE);
}
}
return TRUE;
case WM_COMMAND :
switch (LOWORD(wParam))
{
case IDC_Status0:
if(IsDlgButtonChecked(hDlg, IDC_Status0))
{ EnableWindow(GetDlgItem(hDlg,IDC_SRiseTrig0),TRUE);
EnableWindow(GetDlgItem(hDlg,IDC_SFallTrig0),TRUE);}
else
{ EnableWindow(GetDlgItem(hDlg,IDC_SRiseTrig0),FALSE);
EnableWindow(GetDlgItem(hDlg,IDC_SFallTrig0),FALSE);}
break;
case IDC_Status1:
if(IsDlgButtonChecked(hDlg, IDC_Status1))
{ EnableWindow(GetDlgItem(hDlg,IDC_SRiseTrig1),TRUE);
EnableWindow(GetDlgItem(hDlg,IDC_SFallTrig1),TRUE);}
else
{ EnableWindow(GetDlgItem(hDlg,IDC_SRiseTrig1),FALSE);
EnableWindow(GetDlgItem(hDlg,IDC_SFallTrig1),FALSE);}
break;
case IDC_Status2:
if(IsDlgButtonChecked(hDlg, IDC_Status2))
{ EnableWindow(GetDlgItem(hDlg,IDC_SRiseTrig2),TRUE);
EnableWindow(GetDlgItem(hDlg,IDC_SFallTrig2),TRUE);}
else
{ EnableWindow(GetDlgItem(hDlg,IDC_SRiseTrig2),FALSE);
EnableWindow(GetDlgItem(hDlg,IDC_SFallTrig2),FALSE);}
break;
case IDC_Status3:
if(IsDlgButtonChecked(hDlg, IDC_Status3))
{ EnableWindow(GetDlgItem(hDlg,IDC_SRiseTrig3),TRUE);
EnableWindow(GetDlgItem(hDlg,IDC_SFallTrig3),TRUE);}
else
{ EnableWindow(GetDlgItem(hDlg,IDC_SRiseTrig3),FALSE);
EnableWindow(GetDlgItem(hDlg,IDC_SFallTrig3),FALSE);}
break;
case IDC_Status4:
if(IsDlgButtonChecked(hDlg, IDC_Status4))
{ EnableWindow(GetDlgItem(hDlg,IDC_SRiseTrig4),TRUE);
EnableWindow(GetDlgItem(hDlg,IDC_SFallTrig4),TRUE);}
else
{ EnableWindow(GetDlgItem(hDlg,IDC_SRiseTrig4),FALSE);
EnableWindow(GetDlgItem(hDlg,IDC_SFallTrig4),FALSE);}
break;
case IDC_Status5:
if(IsDlgButtonChecked(hDlg, IDC_Status5))
{ EnableWindow(GetDlgItem(hDlg,IDC_SRiseTrig5),TRUE);
EnableWindow(GetDlgItem(hDlg,IDC_SFallTrig5),TRUE);}
else
{ EnableWindow(GetDlgItem(hDlg,IDC_SRiseTrig5),FALSE);
EnableWindow(GetDlgItem(hDlg,IDC_SFallTrig5),FALSE);}
break;
case IDC_Status6:
if(IsDlgButtonChecked(hDlg, IDC_Status6))
{ EnableWindow(GetDlgItem(hDlg,IDC_SRiseTrig6),TRUE);
EnableWindow(GetDlgItem(hDlg,IDC_SFallTrig6),TRUE);}
else
{ EnableWindow(GetDlgItem(hDlg,IDC_SRiseTrig6),FALSE);
EnableWindow(GetDlgItem(hDlg,IDC_SFallTrig6),FALSE);}
break;
case IDC_Status7:
if(IsDlgButtonChecked(hDlg, IDC_Status7))
{ EnableWindow(GetDlgItem(hDlg,IDC_SRiseTrig7),TRUE);
EnableWindow(GetDlgItem(hDlg,IDC_SFallTrig7),TRUE);}
else
{ EnableWindow(GetDlgItem(hDlg,IDC_SRiseTrig7),FALSE);
EnableWindow(GetDlgItem(hDlg,IDC_SFallTrig7),FALSE);}
break;
case IDOK :
usSEnable = 0; usSRiseEdge = 0; usSFallEdge = 0;
for(i=0; i<8; i++)
{
if(IsDlgButtonChecked(hDlg, (IDC_Status0 + i)))
{
usSEnable |= (0x01 << i);
if(IsDlgButtonChecked(hDlg, (IDC_SRiseTrig0 + i)))
usSRiseEdge |= (0x01 << i);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -