]> git.saurik.com Git - apple/mdnsresponder.git/blob - mDNSWindows/DNSServiceBrowser/WindowsCE/Sources/Application.cpp
mDNSResponder-161.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 Change History (most recent first):
18
19 $Log: Application.cpp,v $
20 Revision 1.3 2006/08/14 23:25:55 cheshire
21 Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
22
23 Revision 1.2 2004/07/13 21:24:27 rpantos
24 Fix for <rdar://problem/3701120>.
25
26 Revision 1.1 2004/06/18 04:04:37 rpantos
27 Move up one level
28
29 Revision 1.2 2004/01/30 02:56:33 bradley
30 Updated to support full Unicode display. Added support for all services on www.dns-sd.org.
31
32 Revision 1.1 2003/08/21 02:16:10 bradley
33 DNSServiceBrowser for HTTP services for Windows CE/PocketPC.
34
35 */
36
37 #include "stdafx.h"
38
39 #include "DNSServices.h"
40
41 #include "BrowserDialog.h"
42
43 #include "Application.h"
44
45 #ifdef _DEBUG
46 #define new DEBUG_NEW
47 #undef THIS_FILE
48 static char THIS_FILE[] = __FILE__;
49 #endif
50
51 //===========================================================================================================================
52 // Message Map
53 //===========================================================================================================================
54
55 BEGIN_MESSAGE_MAP(Application, CWinApp)
56 //{{AFX_MSG_MAP(Application)
57 // NOTE - the ClassWizard will add and remove mapping macros here.
58 // DO NOT EDIT what you see in these blocks of generated code!
59 //}}AFX_MSG_MAP
60 END_MESSAGE_MAP()
61
62 //===========================================================================================================================
63 // Globals
64 //===========================================================================================================================
65
66 Application gApp;
67
68 //===========================================================================================================================
69 // Application
70 //===========================================================================================================================
71
72 Application::Application()
73 : CWinApp()
74 {
75 //
76 }
77
78 //===========================================================================================================================
79 // InitInstance
80 //===========================================================================================================================
81
82 BOOL Application::InitInstance()
83 {
84 DNSStatus err;
85 BrowserDialog dialog;
86 BOOL dnsInitialized;
87
88 dnsInitialized = FALSE;
89
90 err = DNSServicesInitialize( kDNSFlagAdvertise, 0 );
91 if( err )
92 {
93 AfxMessageBox( IDP_SOCKETS_INIT_FAILED );
94 goto exit;
95 }
96 dnsInitialized = TRUE;
97
98 // Display the main browser dialog.
99
100 m_pMainWnd = &dialog;
101 dialog.DoModal();
102
103 // Dialog has been closed. Return false to exit the app and not start the app's message pump.
104
105 exit:
106 if( dnsInitialized )
107 {
108 DNSServicesFinalize();
109 }
110 return( FALSE );
111 }