]> git.saurik.com Git - apple/mdnsresponder.git/blob - mDNSWindows/Applications/DNSServiceBrowser/Windows/Sources/Application.cpp
mDNSResponder-58.8.1.tar.gz
[apple/mdnsresponder.git] / mDNSWindows / Applications / DNSServiceBrowser / Windows / Sources / Application.cpp
1 /*
2 * Copyright (c) 2002-2003 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
11 * file.
12 *
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
20 *
21 * @APPLE_LICENSE_HEADER_END@
22
23 Change History (most recent first):
24
25 $Log: Application.cpp,v $
26 Revision 1.1 2003/08/21 02:06:47 bradley
27 Moved Rendezvous Browser for non-Windows CE into Windows sub-folder.
28
29 Revision 1.5 2003/08/12 19:56:28 cheshire
30 Update to APSL 2.0
31
32 Revision 1.4 2003/07/02 21:20:06 cheshire
33 <rdar://problem/3313413> Update copyright notices, etc., in source code comments
34
35 Revision 1.3 2002/09/21 20:44:55 zarzycki
36 Added APSL info
37
38 Revision 1.2 2002/09/20 08:37:34 bradley
39 Increased the DNS record cache from the default of 64 to 512 entries for larger networks.
40
41 Revision 1.1 2002/09/20 06:12:51 bradley
42 Rendezvous Browser for Windows
43
44 */
45
46 #include <assert.h>
47
48 #include "DNSServices.h"
49
50 #include "Application.h"
51
52 #include "ChooserDialog.h"
53
54 #include "stdafx.h"
55
56 #ifdef _DEBUG
57 #define new DEBUG_NEW
58 #undef THIS_FILE
59 static char THIS_FILE[] = __FILE__;
60 #endif
61
62 //===========================================================================================================================
63 // Message Map
64 //===========================================================================================================================
65
66 BEGIN_MESSAGE_MAP(Application, CWinApp)
67 //{{AFX_MSG_MAP(Application)
68 // NOTE - the ClassWizard will add and remove mapping macros here.
69 // DO NOT EDIT what you see in these blocks of generated code!
70 //}}AFX_MSG
71 ON_COMMAND(ID_HELP, CWinApp::OnHelp)
72 END_MESSAGE_MAP()
73
74 //===========================================================================================================================
75 // Globals
76 //===========================================================================================================================
77
78 Application gApp;
79
80 //===========================================================================================================================
81 // Application
82 //===========================================================================================================================
83
84 Application::Application( void )
85 {
86 //
87 }
88
89 //===========================================================================================================================
90 // InitInstance
91 //===========================================================================================================================
92
93 BOOL Application::InitInstance()
94 {
95 DNSStatus err;
96
97 // WinSock initialization.
98
99 if( !AfxSocketInit() )
100 {
101 AfxMessageBox( IDP_SOCKETS_INIT_FAILED );
102 return( FALSE );
103 }
104
105 // Standard MFC initialization.
106
107 #if( !defined( AFX_DEPRECATED ) )
108 #ifdef _AFXDLL
109 Enable3dControls(); // Call this when using MFC in a shared DLL
110 #else
111 Enable3dControlsStatic(); // Call this when linking to MFC statically
112 #endif
113 #endif
114
115 InitCommonControls();
116
117 // Set up DNS Services.
118
119 err = DNSServicesInitialize( 0, 512 );
120 assert( err == kDNSNoErr );
121
122 // Create the chooser dialog.
123
124 ChooserDialog * dialog;
125
126 m_pMainWnd = NULL;
127 dialog = new ChooserDialog;
128 dialog->Create( IDD_CHOOSER_DIALOG );
129 m_pMainWnd = dialog;
130 dialog->ShowWindow( SW_SHOW );
131
132 return( true );
133 }
134
135 //===========================================================================================================================
136 // ExitInstance
137 //===========================================================================================================================
138
139 int Application::ExitInstance( void )
140 {
141 // Clean up DNS Services.
142
143 DNSServicesFinalize();
144 return( 0 );
145 }