richedit.c 2.77 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 21
 *
 * 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
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  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
/***********************************************************************
Patrik Stridvall's avatar
Patrik Stridvall committed
44
 * DllGetVersion [RICHED32.2]
Alexandre Julliard's avatar
Alexandre Julliard committed
45
 *
46
 * Retrieves version information
Alexandre Julliard's avatar
Alexandre Julliard committed
47
 */
48
HRESULT WINAPI RICHED32_DllGetVersion (DLLVERSIONINFO *pdvi)
Alexandre Julliard's avatar
Alexandre Julliard committed
49
{
Daniel Walker's avatar
Daniel Walker committed
50 51
    TRACE("\n");

52
    if (pdvi->cbSize != sizeof(DLLVERSIONINFO))
Alexandre Julliard's avatar
Alexandre Julliard committed
53 54 55 56 57 58 59 60 61 62
	return E_INVALIDARG;

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

    return S_OK;
}

63 64
/* Unregisters the window class. */
static BOOL RICHED32_Unregister(void)
Alexandre Julliard's avatar
Alexandre Julliard committed
65
{
Daniel Walker's avatar
Daniel Walker committed
66 67
    TRACE("\n");

68 69 70 71 72 73 74 75 76 77
    UnregisterClassA(RICHEDIT_CLASS10A, NULL);
    return TRUE;
}


/* Registers the window class. */
static BOOL RICHED32_Register(void)
{
    WNDCLASSA wndClass;

Alexandre Julliard's avatar
Alexandre Julliard committed
78 79
    ZeroMemory(&wndClass, sizeof(WNDCLASSA));
    wndClass.style = CS_HREDRAW | CS_VREDRAW | CS_GLOBALCLASS;
80
    wndClass.lpfnWndProc = RichEdit10ANSIWndProc;
Alexandre Julliard's avatar
Alexandre Julliard committed
81
    wndClass.cbClsExtra = 0;
82
    wndClass.cbWndExtra = 4;
83
    wndClass.hCursor = LoadCursorA(0, (LPSTR)IDC_ARROW);
Alexandre Julliard's avatar
Alexandre Julliard committed
84
    wndClass.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
85
    wndClass.lpszClassName = RICHEDIT_CLASS10A; /* WC_RICHED32A; */
Alexandre Julliard's avatar
Alexandre Julliard committed
86

87
    RegisterClassA(&wndClass);
Alexandre Julliard's avatar
Alexandre Julliard committed
88

89
    return TRUE;
Alexandre Julliard's avatar
Alexandre Julliard committed
90
}
91

92 93
/* Initialization function */
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
94
{
95 96
    TRACE("\n");
    switch (fdwReason)
97
    {
98 99 100
    case DLL_PROCESS_ATTACH:
        DisableThreadLibraryCalls(hinstDLL);
        return RICHED32_Register();
101

102 103
    case DLL_PROCESS_DETACH:
        return RICHED32_Unregister();
104
    }
105
    return TRUE;
106
}