示例#1
0
BOOL	Application::InitInstance()
{
	DNSStatus		err;
	
	// Standard MFC initialization.

#if( !defined( AFX_DEPRECATED ) )
	#ifdef _AFXDLL
		Enable3dControls();			// Call this when using MFC in a shared DLL
	#else
		Enable3dControlsStatic();	// Call this when linking to MFC statically
	#endif
#endif

	InitCommonControls();
	
	// Set up DNS Services.
	
	err = DNSServicesInitialize( 0, 512 );
	assert( err == kDNSNoErr );
	
	// Create the chooser dialog.
	
	ChooserDialog *		dialog;
	
	m_pMainWnd = NULL;
	dialog = new ChooserDialog;
	dialog->Create( IDD_CHOOSER_DIALOG );
	m_pMainWnd = dialog;
	dialog->ShowWindow( SW_SHOW );
	
	return( true );
}
示例#2
0
BOOL Application::InitInstance()
{
	DNSStatus			err;
	BrowserDialog		dialog;
	BOOL				dnsInitialized;
	
	dnsInitialized = FALSE;
	
	err = DNSServicesInitialize( kDNSFlagAdvertise, 0 );
	if( err )
	{
		AfxMessageBox( IDP_SOCKETS_INIT_FAILED );
		goto exit;
	}
	dnsInitialized = TRUE;

	// Display the main browser dialog.
	
	m_pMainWnd = &dialog;
	dialog.DoModal();

	// Dialog has been closed. Return false to exit the app and not start the app's message pump.

exit:
	if( dnsInitialized )
	{
		DNSServicesFinalize();
	}
	return( FALSE );
}
示例#3
0
文件: Tool.c 项目: withwave/RT5350
int main( int argc, char* argv[] )
{
    DNSStatus		err;

    // Set up DNS Services and install a Console Control Handler to handle things like control-c signals.

    err = DNSServicesInitialize( kDNSFlagAdvertise, 0 );
    require_noerr_string( err, exit, "could not initialize DNSServiceTest" );

#if( __MACH__ )
    signal( SIGINT, SigIntHandler );
#endif

#if( defined( WINVER ) )
    SetConsoleCtrlHandler( ConsoleControlHandler, TRUE );
#endif

    ProcessArgs( argc, argv );

exit:
    DNSServicesFinalize();
    return( err );
}