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