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