本文整理汇总了C++中FConfigFile::SetSection方法的典型用法代码示例。如果您正苦于以下问题:C++ FConfigFile::SetSection方法的具体用法?C++ FConfigFile::SetSection怎么用?C++ FConfigFile::SetSection使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FConfigFile
的用法示例。
在下文中一共展示了FConfigFile::SetSection方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main_AttemptConnection
static void main_AttemptConnection( )
{
char szBuffer[128];
// Update the GUI.
time( &g_tLastSentCommand );
main_SetState( STATE_CONNECTING );
sprintf( szBuffer, "Connecting to %s...", NETWORK_AddressToString( g_ServerAddress ));
main_UpdateStatusbar( szBuffer );
main_UpdateTrayTooltip( szBuffer );
GetDlgItemText( g_hDlg, IDC_SERVERIP, szBuffer, 128 );
// Save this server to our config file.
g_Config.SetSection( "Settings", true );
g_Config.SetValueForKey( "LastServer", szBuffer );
g_Config.WriteConfigFile( );
// Start listening for packets.
if ( g_hThread == NULL )
{
g_hThread = CreateThread( NULL, 0, main_Loop, 0, 0, 0 );
NETWORK_InitBuffer( &g_MessageBuffer, 8192, BUFFERTYPE_WRITE );
}
NETWORK_ClearBuffer( &g_MessageBuffer );
NETWORK_WriteByte( &g_MessageBuffer.ByteStream, CLRC_BEGINCONNECTION );
NETWORK_WriteByte( &g_MessageBuffer.ByteStream, PROTOCOL_VERSION );
NETWORK_LaunchPacket( &g_MessageBuffer, g_ServerAddress );
}
示例2: WinMain
int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd )
{
g_hInst = hInstance;
g_Config.ChangePathName( "settings.ini" );
g_Config.LoadConfigFile( NULL, NULL );
// Read the user's favorites.
if ( g_Config.SetSection("Favorites"))
{
const char *key;
const char *value;
while ( g_Config.NextInSection( key, value ))
{
FAVORITE_s fav;
strncpy( fav.szName, key, 128 );
fav.szName[128] = 0;
strncpy( fav.szAddress, value, strchr( value, '/' ) - value );
fav.szAddress[strchr( value, '/' ) - value] = 0;
strncpy( fav.szPassword, strchr( value, '/' ) + 1, 128 );
fav.szPassword[128] = 0;
g_Favorites.push_back( fav );
}
}
NETWORK_Construct( 99999 );
main_SetState( STATE_WAITING );
DialogBox( g_hInst, MAKEINTRESOURCE( IDD_CONNECTDIALOG ), NULL, main_ConnectDialogCallback );
}
示例3: main_ConnectDialogCallback
//.........这里部分代码省略.........
g_hTrayMenu = CreatePopupMenu( );
AppendMenu( g_hTrayMenu, MF_STRING, IDR_TOGGLE, "Show/Hide" );
AppendMenu( g_hTrayMenu, MF_STRING|MF_POPUP, (UINT)g_hFavoritesMenu, "Favorites");
AppendMenu( g_hTrayMenu, MF_SEPARATOR, 0, 0 );
AppendMenu( g_hTrayMenu, MF_STRING, IDR_EXIT, "Exit" );
// Create the file menu.
HMENU hFileMenu = CreatePopupMenu( );
AppendMenu( hFileMenu, MF_STRING, IDR_EXIT, "Exit" );
// Create the file menu.
HMENU hHelpMenu = CreatePopupMenu( );
AppendMenu( hHelpMenu, MF_STRING, IDR_ABOUT, "About..." );
// Create the main menu.
g_hMainMenu = CreateMenu( );
AppendMenu( g_hMainMenu, MF_STRING|MF_POPUP, (UINT)hFileMenu, "File" );
AppendMenu( g_hMainMenu, MF_STRING|MF_POPUP, (UINT)g_hFavoritesMenu, "Favorites");
AppendMenu( g_hMainMenu, MF_STRING|MF_POPUP, (UINT)hHelpMenu, "Help");
AppendMenu( g_hMainMenu, MF_SEPARATOR, 0, 0 );
SetMenu( hDlg, g_hMainMenu );
// Set up the status bar.
g_hDlgStatusBar = CreateStatusWindow( WS_CHILD | WS_VISIBLE, (LPCTSTR)NULL, hDlg, IDC_STATIC );
// Set up the top, white section.
SendMessage( GetDlgItem( g_hDlg, IDC_INTROTEXT ), WM_SETFONT, (WPARAM) CreateFont( 13, 0, 0, 0, 600, 0, 0, 0, 0, 0, 0, 0, 0, "Tahoma" ), (LPARAM) 1 );
LOGBRUSH LogBrush;
LogBrush.lbStyle = BS_SOLID;
LogBrush.lbColor = RGB( 255, 255, 255 );
g_hWhiteBrush = CreateBrushIndirect( &LogBrush );
// Load the server address that was used last time.
if ( g_Config.HaveSections( ) && g_Config.SetSection( "Settings", true ) && g_Config.GetValueForKey( "LastServer" ) )
SetDlgItemText( hDlg, IDC_SERVERIP, g_Config.GetValueForKey( "LastServer" ) );
}
break;
case WM_COMMAND:
// Selecting a favorite from the menu?
if ( LOWORD( wParam ) > IDR_DYNAMIC_MENU && LOWORD( wParam ) <= IDR_DYNAMIC_MENU + g_Favorites.size( ))
{
main_ConnectToFavorite( LOWORD( wParam ) - IDR_DYNAMIC_MENU - 1 );
return TRUE;
}
switch ( LOWORD( wParam ))
{
// This also occurs when esc is pressed.
case IDCANCEL:
if ( g_State == STATE_CONNECTING )
{
main_SetState( STATE_WAITING );
main_EnableConnectionButtons( TRUE );
main_UpdateStatusbar( "Cancelled." );
}
else
main_Quit( );
break;
// The "connect" button.
case IDOK:
// Disable all the inputs.
main_EnableConnectionButtons( FALSE );