richedit.c 2.68 KB
Newer Older
Alexandre Julliard's avatar
Alexandre Julliard committed
1 2 3
/*
 * RichEdit32  functions
 *
4
 * This module is a simple wrapper for the RichEdit 2.0 control
Alexandre Julliard's avatar
Alexandre Julliard committed
5 6
 *
 * Copyright 2000 by Jean-Claude Batista
7
 * Copyright 2005 Mike McCormack
8 9 10 11 12 13 14 15 16 17 18 19 20
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * 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
Alexandre Julliard's avatar
Alexandre Julliard committed
22
 */
23

24
#include <stdarg.h>
25
#include <string.h>
26
#include "windef.h"
Alexandre Julliard's avatar
Alexandre Julliard committed
27
#include "winbase.h"
28
#include "wingdi.h"
29
#include "winreg.h"
Alexandre Julliard's avatar
Alexandre Julliard committed
30
#include "winerror.h"
31
#include "winuser.h"
Alexandre Julliard's avatar
Alexandre Julliard committed
32
#include "richedit.h"
33
#include "shlwapi.h"
Alexandre Julliard's avatar
Alexandre Julliard committed
34

35
#include "wine/debug.h"
Alexandre Julliard's avatar
Alexandre Julliard committed
36

37
WINE_DEFAULT_DEBUG_CHANNEL(richedit);
Alexandre Julliard's avatar
Alexandre Julliard committed
38

39 40
/* Window procedure of the RichEdit 1.0 control in riched20.dll */
extern LRESULT WINAPI RichEdit10ANSIWndProc(HWND, UINT, WPARAM, LPARAM);
Daniel Walker's avatar
Daniel Walker committed
41

Alexandre Julliard's avatar
Alexandre Julliard committed
42

43 44 45 46 47
/* Registers the window class. */
static BOOL RICHED32_Register(void)
{
    WNDCLASSA wndClass;

Alexandre Julliard's avatar
Alexandre Julliard committed
48
    ZeroMemory(&wndClass, sizeof(WNDCLASSA));
49
    wndClass.style = CS_DBLCLKS | CS_HREDRAW | CS_VREDRAW | CS_GLOBALCLASS;
50
    wndClass.lpfnWndProc = RichEdit10ANSIWndProc;
Alexandre Julliard's avatar
Alexandre Julliard committed
51
    wndClass.cbClsExtra = 0;
52
    wndClass.cbWndExtra = sizeof(void *);
53
    wndClass.hCursor = LoadCursorA(0, (LPSTR)IDC_ARROW);
Alexandre Julliard's avatar
Alexandre Julliard committed
54
    wndClass.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
55
    wndClass.lpszClassName = RICHEDIT_CLASS10A; /* WC_RICHED32A; */
Alexandre Julliard's avatar
Alexandre Julliard committed
56

57
    RegisterClassA(&wndClass);
Alexandre Julliard's avatar
Alexandre Julliard committed
58

59
    return TRUE;
Alexandre Julliard's avatar
Alexandre Julliard committed
60
}
61

62 63
/* Initialization function */
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
64
{
65 66
    TRACE("\n");
    switch (fdwReason)
67
    {
68 69 70
    case DLL_PROCESS_ATTACH:
        DisableThreadLibraryCalls(hinstDLL);
        return RICHED32_Register();
71

72
    case DLL_PROCESS_DETACH:
73 74 75
        if (lpvReserved) break;
        UnregisterClassA(RICHEDIT_CLASS10A, NULL);
        break;
76
    }
77
    return TRUE;
78
}
79 80 81 82 83 84

/***********************************************************************
 * DllGetVersion [RICHED32.2]
 *
 * Retrieves version information
 */
85
HRESULT WINAPI DllGetVersion (DLLVERSIONINFO *pdvi)
86 87 88 89 90 91 92 93 94 95 96 97 98
{
    TRACE("\n");

    if (pdvi->cbSize != sizeof(DLLVERSIONINFO))
	return E_INVALIDARG;

    pdvi->dwMajorVersion = 4;
    pdvi->dwMinorVersion = 0;
    pdvi->dwBuildNumber = 0;
    pdvi->dwPlatformID = 0;

    return S_OK;
}