]> git.saurik.com Git - wxWidgets.git/blame - src/msw/main.cpp
Added dcbase.cpp
[wxWidgets.git] / src / msw / main.cpp
CommitLineData
2bda0e17
KB
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
a3b46648
UU
12#ifdef __GNUG__
13#pragma implementation
14#endif
15
2bda0e17
KB
16// For compilers that support precompilation, includes "wx.h".
17#include "wx/wxprec.h"
18
19#ifdef __BORLANDC__
20#pragma hdrstop
21#endif
22
2432b92d 23#include "wx/event.h"
2bda0e17
KB
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
57c208c5
JS
43#ifdef __TWIN32__
44
45extern "C"
46BOOL PASCAL WinMain(HANDLE hInstance, HANDLE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
47
48#else
49
2bda0e17
KB
50#ifdef __WATCOMC__
51int PASCAL
52#else
53int APIENTRY
54#endif
55
57c208c5
JS
56 WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow )
57#endif
58// __TWIN32__
59
2bda0e17 60{
57c208c5 61 return wxEntry((WXHINSTANCE) hInstance, (WXHINSTANCE) hPrevInstance, lpCmdLine, nCmdShow);
2bda0e17
KB
62}
63#endif
64
65/////////////////////////////////////////////////////////////////////////////////
66// DllMain
67
68#if defined(_WINDLL)
69
70// DLL entry point
71
72extern "C"
73#ifdef __BORLANDC__
74// SCD: I don't know why, but also OWL uses this function
75BOOL WINAPI DllEntryPoint (HANDLE hModule, DWORD fdwReason, LPVOID lpReserved)
76#else
77BOOL WINAPI DllMain (HANDLE hModule, DWORD fdwReason, LPVOID lpReserved)
78#endif
79{
80 switch (fdwReason)
81 {
82 case DLL_PROCESS_ATTACH:
83 // Only call wxEntry if the application itself is part of the DLL.
84 // If only the wxWindows library is in the DLL, then the initialisation
85 // will be called when the application implicitly calls WinMain.
86
87#if !defined(WXMAKINGDLL)
88 return wxEntry((WXHINSTANCE) hModule);
89#endif
90 break;
91
92 case DLL_PROCESS_DETACH:
93 default:
94 break;
95 }
96 return TRUE;
97}
98
99#endif
100
101#endif
102