📄 perform.cpp
字号:
::EnableWindow( hWndAliveTimeout, TRUE );
}
else
{
::EnableWindow( hWndAliveCount, FALSE );
::EnableWindow( hWndAliveTimeout, FALSE );
};
break;
default:;
}
Changed( hDlg );
};
break;
case WM_NOTIFY:
switch( ((NMHDR *)lParam)->code )
{
case PSN_QUERYCANCEL:
return SHEET->Cancel(pInterface, hDlg);
case PSN_KILLACTIVE:
if ( IsChanged() )
{
enum { BUF_SIZE=1023 };
char szBuf[BUF_SIZE+1];
/*
** Threads
*/
*szBuf = 0;
SendMessage( hWndThreads, WM_GETTEXT, BUF_SIZE, (LPARAM)szBuf );
int iTest = atoi( szBuf );
if ( iTest<1 || iTest>512 )
{
/*
** Give message and abort change
*/
MessageBox( hDlg, "Threads must be in the range [1..512]",
"Configuration Error", MB_OK );
SetFocus( hWndThreads );
SendMessage( hWndThreads, EM_SETSEL, 0, -1 );
SetWindowLong( hDlg, DWL_MSGRESULT, PSNRET_INVALID_NOCHANGEPAGE );
return (TRUE);
};
M_ReplaceValue( pConfig, "General", "Threads", szBuf );
/*
** Receive Timeout
*/
*szBuf = 0;
::SendMessage( hWndRecv, WM_GETTEXT, BUF_SIZE, (LPARAM)szBuf );
int iLen = strlen(szBuf);
for( iTest=0; iTest<iLen; iTest++)
{
if ( isalpha( szBuf[iTest] ) )
{
/*
** Give message and abort change
*/
MessageBox( hDlg, "Field contains alphanumeric characters.",
"Configuration Error", MB_OK | MB_ICONEXCLAMATION );
SetFocus( hWndRecv );
SendMessage( hWndRecv, EM_SETSEL, 0, -1 );
SetWindowLong( hDlg, DWL_MSGRESULT, PSNRET_INVALID_NOCHANGEPAGE );
return (TRUE);
};
};
iTest = atoi( szBuf );
if ( iTest<1 && iTest!=-1 )
{
/*
** Give message and abort change
*/
MessageBox( hDlg, "Receive timeout must be in the range [-1,1..n]",
"Configuration Error", MB_OK );
SetFocus( hWndRecv );
SendMessage( hWndRecv, EM_SETSEL, 0, -1 );
SetWindowLong( hDlg, DWL_MSGRESULT, PSNRET_INVALID_NOCHANGEPAGE );
return (TRUE);
};
M_ReplaceValue( pConfig, "General", "RecvTimeout", szBuf );
/*
** Send Timeout
*/
*szBuf = 0;
::SendMessage( hWndSend, WM_GETTEXT, BUF_SIZE, (LPARAM)szBuf );
iLen = strlen(szBuf);
for( iTest=0; iTest<iLen; iTest++)
{
if ( isalpha( szBuf[iTest] ) )
{
/*
** Give message and abort change
*/
MessageBox( hDlg, "Field contains alphanumeric characters.",
"Configuration Error", MB_OK | MB_ICONEXCLAMATION );
SetFocus( hWndSend );
SendMessage( hWndSend, EM_SETSEL, 0, -1 );
SetWindowLong( hDlg, DWL_MSGRESULT, PSNRET_INVALID_NOCHANGEPAGE );
return (TRUE);
};
};
iTest = atoi( szBuf );
if ( iTest<1 && iTest!=-1 )
{
/*
** Give message and abort change
*/
MessageBox( hDlg, "Send timeout must be in the range [-1,1..n]",
"Configuration Error", MB_OK );
SetFocus( hWndSend );
SendMessage( hWndSend, EM_SETSEL, 0, -1 );
SetWindowLong( hDlg, DWL_MSGRESULT, PSNRET_INVALID_NOCHANGEPAGE );
return (TRUE);
};
M_ReplaceValue( pConfig, "General", "SendTimeout", szBuf );
/*
** Keep-Alive
*/
if ( ::SendMessage( hWndKeepOpen, BM_GETCHECK, 0, 0 )==BST_CHECKED )
{ M_ReplaceValue( pConfig, "General", "KeepOpen", "On" ); }
else
{ M_ReplaceValue( pConfig, "General", "KeepOpen", "Off" ); };
/*
** Keep-Alive Count
*/
*szBuf = 0;
::SendMessage( hWndAliveCount, WM_GETTEXT, BUF_SIZE, (LPARAM)szBuf );
iTest = atoi( szBuf );
if ( iTest<1 )
{
/*
** Give message and abort change
*/
MessageBox( hDlg, "Keep-alive count must be in the range [1..n]",
"Configuration Error", MB_OK );
SetFocus( hWndAliveCount );
SendMessage( hWndAliveCount, EM_SETSEL, 0, -1 );
SetWindowLong( hDlg, DWL_MSGRESULT, PSNRET_INVALID_NOCHANGEPAGE );
return (TRUE);
};
M_ReplaceValue( pConfig, "General", "KeepOpenCount", szBuf );
/*
** Keep-Alive Timeout
*/
*szBuf = 0;
::SendMessage( hWndAliveTimeout, WM_GETTEXT, BUF_SIZE, (LPARAM)szBuf );
iLen = strlen(szBuf);
for( iTest=0; iTest<iLen; iTest++)
{
if ( isalpha( szBuf[iTest] ) )
{
/*
** Give message and abort change
*/
MessageBox( hDlg, "Field contains alphanumeric characters.",
"Configuration Error", MB_OK | MB_ICONEXCLAMATION );
SetFocus( hWndAliveTimeout );
SendMessage( hWndAliveTimeout, EM_SETSEL, 0, -1 );
SetWindowLong( hDlg, DWL_MSGRESULT, PSNRET_INVALID_NOCHANGEPAGE );
return (TRUE);
};
};
iTest = atoi( szBuf );
if ( iTest<1 && iTest!=-1 )
{
/*
** Give message and abort change
*/
MessageBox( hDlg, "Keep-alive timeout must be in the range [-1,1..n]",
"Configuration Error", MB_OK );
SetFocus( hWndAliveTimeout );
SendMessage( hWndAliveTimeout, EM_SETSEL, 0, -1 );
SetWindowLong( hDlg, DWL_MSGRESULT, PSNRET_INVALID_NOCHANGEPAGE );
return (TRUE);
};
M_ReplaceValue( pConfig, "General", "KeepOpenTimeout", szBuf );
/*
** DNS Reverse Lookup
*/
if ( ::SendMessage( hWndReverse, BM_GETCHECK, 0, 0 )==BST_CHECKED )
{ M_ReplaceValue( pConfig, "General", "DNSReverseLookup", "On" ); }
else
{ M_ReplaceValue( pConfig, "General", "DNSReverseLookup", "" ); };
/*
** Debug Log
*/
if ( ::SendMessage( hWndDebug, BM_GETCHECK, 0, 0 )==BST_CHECKED )
{
M_ReplaceValue( pConfig, "General", "Debug", "On" );
/*
** Give message and abort change
*/
MessageBox( hDlg, "Debug log is extremely verbose. Don't even \
think about using it in a production server.", "Debug Log Warning", MB_OK | MB_ICONWARNING );
}
else
{ M_ReplaceValue( pConfig, "General", "Debug", "" ); };
/*
** Error-Log
*/
if ( ::SendMessage( hWndErrorLog, BM_GETCHECK, 0, 0 )==BST_CHECKED )
{ M_ReplaceValue( pConfig, "General", "ErrorLog", "On" ); }
else
{ M_ReplaceValue( pConfig, "General", "ErrorLog", "" ); };
/*
** Processes
*/
*szBuf = 0;
SendMessage( hWndProcs, WM_GETTEXT, BUF_SIZE, (LPARAM)szBuf );
iTest = atoi( szBuf );
if ( iTest<1 || iTest>512 )
{
/*
** Give message and abort change
*/
MessageBox( hDlg, "Processes must be in the range [1..512]",
"Configuration Error", MB_OK );
SetFocus( hWndProcs );
SendMessage( hWndProcs, EM_SETSEL, 0, -1 );
SetWindowLong( hDlg, DWL_MSGRESULT, PSNRET_INVALID_NOCHANGEPAGE );
return (TRUE);
};
M_ReplaceValue( pConfig, "General", "Processes", szBuf );
/*
** ExitAfter
*/
*szBuf = 0;
SendMessage( hWndExitAfter, WM_GETTEXT, BUF_SIZE, (LPARAM)szBuf );
iTest = atoi( szBuf );
if ( iTest<1 && iTest!=-1 )
{
/*
** Give message and abort change
*/
MessageBox( hDlg, "Exit-after must be in the range [-1,1..n]",
"Configuration Error", MB_OK );
SetFocus( hWndExitAfter );
SendMessage( hWndExitAfter, EM_SETSEL, 0, -1 );
SetWindowLong( hDlg, DWL_MSGRESULT, PSNRET_INVALID_NOCHANGEPAGE );
return (TRUE);
};
M_ReplaceValue( pConfig, "General", "ExitAfter", szBuf );
/*
** Reuse Threads
*/
if ( ::SendMessage( hWndReuse, BM_GETCHECK, 0, 0 )==BST_CHECKED )
{ M_ReplaceValue( pConfig, "General", "ReuseThreads", "On" ); }
else
{ M_ReplaceValue( pConfig, "General", "ReuseThreads", "" ); };
}
SetWindowLong( hDlg, DWL_MSGRESULT, FALSE );
return (TRUE);
case PSN_APPLY:
return SHEET->SaveConfig(pInterface, hDlg);
default:
return (FALSE);
};
break;
default:
return (FALSE);
};
return FALSE;
};
};
/*____________________________________________________________________________*\
*
Function:
Synopsis:
Description:
\*____________________________________________________________________________*/
static BOOL CALLBACK fnDialogProc(HWND hDlg, UINT uMsg, WPARAM wParam,
LPARAM lParam)
{
if ( uMsg==WM_INITDIALOG )
{
::SetWindowLong( hDlg, DWL_USER, ((LPPROPSHEETPAGE)lParam)->lParam );
};
PerformancePage *pPage = (PerformancePage *)::GetWindowLong( hDlg, DWL_USER );
return pPage ? pPage->DialogProc( hDlg, uMsg, wParam, lParam ) : FALSE;
}
/*____________________________________________________________________________*\
*
Function:
Synopsis:
Description:
\*____________________________________________________________________________*/
PUBLIC_PIAPI int PerformancePage_constructor( PIObject *pObj,
int iArgc, const char *ppArgv[] )
{
return IFaceBase_constructor( pObj, PI_NEW( PerformancePage( pObj,
iArgc, ppArgv ) ) );
}
#if 0
/*___+++CNF_BEGIN+++___*/
<Class>
Name PerformancePageClass
Type LogicExtension
Library IntrFace
OnClassLoad IFaceBase_onClassLoad
Constructor PerformancePage_constructor
CopyConstructor IFaceBase_copyConstructor
Destructor IFaceBase_destructor
Execute IFaceBase_execute
</Class>
<Object>
Name PerformancePage
Class PerformancePageClass
</Object>
/*___+++CNF_END+++___*/
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -