]>
Commit | Line | Data |
---|---|---|
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/app.h" | |
24 | #include <windows.h> | |
25 | ||
26 | // May wish not to have a DllMain or WinMain, e.g. if we're programming | |
27 | // a Netscape plugin. | |
28 | #ifndef NOMAIN | |
29 | ||
30 | // NT defines APIENTRY, 3.x not | |
31 | #if !defined(APIENTRY) | |
32 | #define APIENTRY FAR PASCAL | |
33 | #endif | |
34 | ||
35 | ///////////////////////////////////////////////////////////////////////////////// | |
36 | // WinMain | |
37 | // Note that WinMain is also defined in dummy.obj, which is linked to | |
38 | // an application that is using the DLL version of wxWindows. | |
39 | ||
40 | #if !defined(_WINDLL) | |
41 | ||
42 | #ifdef __WATCOMC__ | |
43 | int PASCAL | |
44 | #else | |
45 | int APIENTRY | |
46 | #endif | |
47 | ||
48 | WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR m_lpCmdLine, int nCmdShow ) | |
49 | { | |
50 | return wxEntry((WXHINSTANCE) hInstance, (WXHINSTANCE) hPrevInstance, m_lpCmdLine, nCmdShow); | |
51 | } | |
52 | #endif | |
53 | ||
54 | ///////////////////////////////////////////////////////////////////////////////// | |
55 | // DllMain | |
56 | ||
57 | #if defined(_WINDLL) | |
58 | ||
59 | // DLL entry point | |
60 | ||
61 | extern "C" | |
62 | #ifdef __BORLANDC__ | |
63 | // SCD: I don't know why, but also OWL uses this function | |
64 | BOOL WINAPI DllEntryPoint (HANDLE hModule, DWORD fdwReason, LPVOID lpReserved) | |
65 | #else | |
66 | BOOL WINAPI DllMain (HANDLE hModule, DWORD fdwReason, LPVOID lpReserved) | |
67 | #endif | |
68 | { | |
69 | switch (fdwReason) | |
70 | { | |
71 | case DLL_PROCESS_ATTACH: | |
72 | // Only call wxEntry if the application itself is part of the DLL. | |
73 | // If only the wxWindows library is in the DLL, then the initialisation | |
74 | // will be called when the application implicitly calls WinMain. | |
75 | ||
76 | #if !defined(WXMAKINGDLL) | |
77 | return wxEntry((WXHINSTANCE) hModule); | |
78 | #endif | |
79 | break; | |
80 | ||
81 | case DLL_PROCESS_DETACH: | |
82 | default: | |
83 | break; | |
84 | } | |
85 | return TRUE; | |
86 | } | |
87 | ||
88 | #endif | |
89 | ||
90 | #endif | |
91 |