Home | History | Annotate | Download | only in Sources
      1 /* -*- Mode: C; tab-width: 4 -*-
      2  *
      3  * Copyright (c) 2002-2004 Apple Computer, Inc. All rights reserved.
      4  *
      5  * Licensed under the Apache License, Version 2.0 (the "License");
      6  * you may not use this file except in compliance with the License.
      7  * You may obtain a copy of the License at
      8  *
      9  *     http://www.apache.org/licenses/LICENSE-2.0
     10  *
     11  * Unless required by applicable law or agreed to in writing, software
     12  * distributed under the License is distributed on an "AS IS" BASIS,
     13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     14  * See the License for the specific language governing permissions and
     15  * limitations under the License.
     16  */
     17 
     18 #include	<assert.h>
     19 
     20 #include	"StdAfx.h"
     21 
     22 #include	"DNSServices.h"
     23 
     24 #include	"Application.h"
     25 
     26 #include	"ChooserDialog.h"
     27 
     28 #include	"stdafx.h"
     29 
     30 #ifdef _DEBUG
     31 #define new DEBUG_NEW
     32 #undef THIS_FILE
     33 static char THIS_FILE[] = __FILE__;
     34 #endif
     35 
     36 //===========================================================================================================================
     37 //	Message Map
     38 //===========================================================================================================================
     39 
     40 BEGIN_MESSAGE_MAP(Application, CWinApp)
     41 	//{{AFX_MSG_MAP(Application)
     42 		// NOTE - the ClassWizard will add and remove mapping macros here.
     43 		//    DO NOT EDIT what you see in these blocks of generated code!
     44 	//}}AFX_MSG
     45 	ON_COMMAND(ID_HELP, CWinApp::OnHelp)
     46 END_MESSAGE_MAP()
     47 
     48 //===========================================================================================================================
     49 //	Globals
     50 //===========================================================================================================================
     51 
     52 Application		gApp;
     53 
     54 //===========================================================================================================================
     55 //	Application
     56 //===========================================================================================================================
     57 
     58 Application::Application( void )
     59 {
     60 	//
     61 }
     62 
     63 //===========================================================================================================================
     64 //	InitInstance
     65 //===========================================================================================================================
     66 
     67 BOOL	Application::InitInstance()
     68 {
     69 	DNSStatus		err;
     70 
     71 	// Standard MFC initialization.
     72 
     73 #if( !defined( AFX_DEPRECATED ) )
     74 	#ifdef _AFXDLL
     75 		Enable3dControls();			// Call this when using MFC in a shared DLL
     76 	#else
     77 		Enable3dControlsStatic();	// Call this when linking to MFC statically
     78 	#endif
     79 #endif
     80 
     81 	InitCommonControls();
     82 
     83 	// Set up DNS Services.
     84 
     85 	err = DNSServicesInitialize( 0, 512 );
     86 	assert( err == kDNSNoErr );
     87 
     88 	// Create the chooser dialog.
     89 
     90 	ChooserDialog *		dialog;
     91 
     92 	m_pMainWnd = NULL;
     93 	dialog = new ChooserDialog;
     94 	dialog->Create( IDD_CHOOSER_DIALOG );
     95 	m_pMainWnd = dialog;
     96 	dialog->ShowWindow( SW_SHOW );
     97 
     98 	return( true );
     99 }
    100 
    101 //===========================================================================================================================
    102 //	ExitInstance
    103 //===========================================================================================================================
    104 
    105 int	Application::ExitInstance( void )
    106 {
    107 	// Clean up DNS Services.
    108 
    109 	DNSServicesFinalize();
    110 	return( 0 );
    111 }
    112