Doc & Symantec C++ fixes
[wxWidgets.git] / src / msw / main.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: main.cpp
3 // Purpose: Main/DllMain
4 // Author: Julian Smart
5 // Modified by:
6 // Created: 04/01/98
7 // RCS-ID: $Id$
8 // Copyright: (c) Julian Smart and Markus Holzem
9 // Licence: wxWindows license
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifdef __GNUG__
13 #pragma implementation
14 #endif
15
16 // For compilers that support precompilation, includes "wx.h".
17 #include "wx/wxprec.h"
18
19 #ifdef __BORLANDC__
20 #pragma hdrstop
21 #endif
22
23 #include "wx/event.h"
24 #include "wx/app.h"
25 #include <windows.h>
26
27 // May wish not to have a DllMain or WinMain, e.g. if we're programming
28 // a Netscape plugin.
29 #ifndef NOMAIN
30
31 // NT defines APIENTRY, 3.x not
32 #if !defined(APIENTRY)
33 #define APIENTRY FAR PASCAL
34 #endif
35
36 /////////////////////////////////////////////////////////////////////////////////
37 // WinMain
38 // Note that WinMain is also defined in dummy.obj, which is linked to
39 // an application that is using the DLL version of wxWindows.
40
41 #if !defined(_WINDLL)
42
43 #ifdef __WATCOMC__
44 int PASCAL
45 #else
46 int APIENTRY
47 #endif
48
49 WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR m_lpCmdLine, int nCmdShow )
50 {
51 return wxEntry((WXHINSTANCE) hInstance, (WXHINSTANCE) hPrevInstance, m_lpCmdLine, nCmdShow);
52 }
53 #endif
54
55 /////////////////////////////////////////////////////////////////////////////////
56 // DllMain
57
58 #if defined(_WINDLL)
59
60 // DLL entry point
61
62 extern "C"
63 #ifdef __BORLANDC__
64 // SCD: I don't know why, but also OWL uses this function
65 BOOL WINAPI DllEntryPoint (HANDLE hModule, DWORD fdwReason, LPVOID lpReserved)
66 #else
67 BOOL WINAPI DllMain (HANDLE hModule, DWORD fdwReason, LPVOID lpReserved)
68 #endif
69 {
70 switch (fdwReason)
71 {
72 case DLL_PROCESS_ATTACH:
73 // Only call wxEntry if the application itself is part of the DLL.
74 // If only the wxWindows library is in the DLL, then the initialisation
75 // will be called when the application implicitly calls WinMain.
76
77 #if !defined(WXMAKINGDLL)
78 return wxEntry((WXHINSTANCE) hModule);
79 #endif
80 break;
81
82 case DLL_PROCESS_DETACH:
83 default:
84 break;
85 }
86 return TRUE;
87 }
88
89 #endif
90
91 #endif
92