[RICHED32]
[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 /* Registers the window class. */
48 static BOOL RICHED32_Register(void)
49 {
50 WNDCLASSA wndClass;
51
52 ZeroMemory(&wndClass, sizeof(WNDCLASSA));
53 wndClass.style = CS_DBLCLKS | CS_HREDRAW | CS_VREDRAW | CS_GLOBALCLASS;
54 wndClass.lpfnWndProc = RichEdit10ANSIWndProc;
55 wndClass.cbClsExtra = 0;
56 wndClass.cbWndExtra = sizeof(void *);
57 wndClass.hCursor = LoadCursorA(0, (LPSTR)IDC_ARROW);
58 wndClass.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
59 wndClass.lpszClassName = RICHEDIT_CLASS10A; /* WC_RICHED32A; */
60
61 RegisterClassA(&wndClass);
62
63 return TRUE;
64 }
65
66 /* Initialization function */
67 BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
68 {
69 TRACE("\n");
70 switch (fdwReason)
71 {
72 case DLL_PROCESS_ATTACH:
73 DisableThreadLibraryCalls(hinstDLL);
74 return RICHED32_Register();
75
76 case DLL_PROCESS_DETACH:
77 if (lpvReserved) break;
78 UnregisterClassA(RICHEDIT_CLASS10A, NULL);
79 break;
80 }
81 return TRUE;
82 }
83
84 /***********************************************************************
85 * DllGetVersion [RICHED32.2]
86 *
87 * Retrieves version information
88 */
89 HRESULT WINAPI DllGetVersion (DLLVERSIONINFO *pdvi)
90 {
91 TRACE("\n");
92
93 if (pdvi->cbSize != sizeof(DLLVERSIONINFO))
94 return E_INVALIDARG;
95
96 pdvi->dwMajorVersion = 4;
97 pdvi->dwMinorVersion = 0;
98 pdvi->dwBuildNumber = 0;
99 pdvi->dwPlatformID = 0;
100
101 return S_OK;
102 }