76a014c437f5634680374257798ce795569c98bb
[reactos.git] / reactos / dll / win32 / riched32 / richedit.c
1 /*
2 * RichEdit32 functions
3 *
4 * This module is a simple wrapper for the RichEdit 2.0 control
5 *
6 * Copyright 2000 by Jean-Claude Batista
7 * Copyright 2005 Mike McCormack
8 *
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public
11 * License as published by the Free Software Foundation; either
12 * version 2.1 of the License, or (at your option) any later version.
13 *
14 * This library is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
18 *
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with this library; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
22 */
23
24 #define WIN32_NO_STATUS
25 #define _INC_WINDOWS
26 #define COM_NO_WINDOWS_H
27
28 #include <stdarg.h>
29 //#include <string.h>
30 #include <windef.h>
31 #include <winbase.h>
32 #include <wingdi.h>
33 #include <winreg.h>
34 //#include "winerror.h"
35 #include <winuser.h>
36 #include <richedit.h>
37 #include <shlwapi.h>
38
39 #include <wine/debug.h>
40
41 WINE_DEFAULT_DEBUG_CHANNEL(richedit);
42
43 /* Window procedure of the RichEdit 1.0 control in riched20.dll */
44 extern LRESULT WINAPI RichEdit10ANSIWndProc(HWND, UINT, WPARAM, LPARAM);
45
46
47 /* Unregisters the window class. */
48 static BOOL RICHED32_Unregister(void)
49 {
50 TRACE("\n");
51
52 UnregisterClassA(RICHEDIT_CLASS10A, NULL);
53 return TRUE;
54 }
55
56
57 /* Registers the window class. */
58 static BOOL RICHED32_Register(void)
59 {
60 WNDCLASSA wndClass;
61
62 ZeroMemory(&wndClass, sizeof(WNDCLASSA));
63 wndClass.style = CS_DBLCLKS | CS_HREDRAW | CS_VREDRAW | CS_GLOBALCLASS;
64 wndClass.lpfnWndProc = RichEdit10ANSIWndProc;
65 wndClass.cbClsExtra = 0;
66 wndClass.cbWndExtra = sizeof(void *);
67 wndClass.hCursor = LoadCursorA(0, (LPSTR)IDC_ARROW);
68 wndClass.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
69 wndClass.lpszClassName = RICHEDIT_CLASS10A; /* WC_RICHED32A; */
70
71 RegisterClassA(&wndClass);
72
73 return TRUE;
74 }
75
76 /* Initialization function */
77 BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
78 {
79 TRACE("\n");
80 switch (fdwReason)
81 {
82 case DLL_PROCESS_ATTACH:
83 DisableThreadLibraryCalls(hinstDLL);
84 return RICHED32_Register();
85
86 case DLL_PROCESS_DETACH:
87 return RICHED32_Unregister();
88 }
89 return TRUE;
90 }
91
92 /***********************************************************************
93 * DllGetVersion [RICHED32.2]
94 *
95 * Retrieves version information
96 */
97 HRESULT WINAPI DllGetVersion (DLLVERSIONINFO *pdvi)
98 {
99 TRACE("\n");
100
101 if (pdvi->cbSize != sizeof(DLLVERSIONINFO))
102 return E_INVALIDARG;
103
104 pdvi->dwMajorVersion = 4;
105 pdvi->dwMinorVersion = 0;
106 pdvi->dwBuildNumber = 0;
107 pdvi->dwPlatformID = 0;
108
109 return S_OK;
110 }