]> git.saurik.com Git - apple/mdnsresponder.git/blob - mDNSWindows/DNSServiceBrowser/WindowsCE/Sources/Application.cpp
mDNSResponder-379.38.1.tar.gz
[apple/mdnsresponder.git] / mDNSWindows / DNSServiceBrowser / WindowsCE / Sources / Application.cpp
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 "stdafx.h"
19
20 #include "DNSServices.h"
21
22 #include "BrowserDialog.h"
23
24 #include "Application.h"
25
26 #ifdef _DEBUG
27 #define new DEBUG_NEW
28 #undef THIS_FILE
29 static char THIS_FILE[] = __FILE__;
30 #endif
31
32 //===========================================================================================================================
33 // Message Map
34 //===========================================================================================================================
35
36 BEGIN_MESSAGE_MAP(Application, CWinApp)
37 //{{AFX_MSG_MAP(Application)
38 // NOTE - the ClassWizard will add and remove mapping macros here.
39 // DO NOT EDIT what you see in these blocks of generated code!
40 //}}AFX_MSG_MAP
41 END_MESSAGE_MAP()
42
43 //===========================================================================================================================
44 // Globals
45 //===========================================================================================================================
46
47 Application gApp;
48
49 //===========================================================================================================================
50 // Application
51 //===========================================================================================================================
52
53 Application::Application()
54 : CWinApp()
55 {
56 //
57 }
58
59 //===========================================================================================================================
60 // InitInstance
61 //===========================================================================================================================
62
63 BOOL Application::InitInstance()
64 {
65 DNSStatus err;
66 BrowserDialog dialog;
67 BOOL dnsInitialized;
68
69 dnsInitialized = FALSE;
70
71 err = DNSServicesInitialize( kDNSFlagAdvertise, 0 );
72 if( err )
73 {
74 AfxMessageBox( IDP_SOCKETS_INIT_FAILED );
75 goto exit;
76 }
77 dnsInitialized = TRUE;
78
79 // Display the main browser dialog.
80
81 m_pMainWnd = &dialog;
82 dialog.DoModal();
83
84 // Dialog has been closed. Return false to exit the app and not start the app's message pump.
85
86 exit:
87 if( dnsInitialized )
88 {
89 DNSServicesFinalize();
90 }
91 return( FALSE );
92 }