xref: /reactos/base/applications/calc/htmlhelp.c (revision 055c5a9b)
1f6c565bcSCarlo-Bramini /*
2f6c565bcSCarlo-Bramini  * ReactOS Calc (HtmlHelp support)
3f6c565bcSCarlo-Bramini  *
4f6c565bcSCarlo-Bramini  * Copyright 2007-2017, Carlo Bramini
5f6c565bcSCarlo-Bramini  *
6f6c565bcSCarlo-Bramini  * This program is free software; you can redistribute it and/or
7f6c565bcSCarlo-Bramini  * modify it under the terms of the GNU Lesser General Public
8f6c565bcSCarlo-Bramini  * License as published by the Free Software Foundation; either
9f6c565bcSCarlo-Bramini  * version 2 of the License, or (at your option) any later version.
10f6c565bcSCarlo-Bramini  *
11f6c565bcSCarlo-Bramini  * This library is distributed in the hope that it will be useful,
12f6c565bcSCarlo-Bramini  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13f6c565bcSCarlo-Bramini  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14f6c565bcSCarlo-Bramini  * Lesser General Public License for more details.
15f6c565bcSCarlo-Bramini  *
16f6c565bcSCarlo-Bramini  * You should have received a copy of the GNU Lesser General Public
17f6c565bcSCarlo-Bramini  * License along with this library; if not, write to the Free Software
18f6c565bcSCarlo-Bramini  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
19f6c565bcSCarlo-Bramini  */
20f6c565bcSCarlo-Bramini 
21f6c565bcSCarlo-Bramini #include "calc.h"
22f6c565bcSCarlo-Bramini 
23f6c565bcSCarlo-Bramini #define GET_CB(name) \
24f6c565bcSCarlo-Bramini     calc_##name = (type_##name)GetProcAddress(hHtmlHelp, #name); \
25f6c565bcSCarlo-Bramini     if (calc_##name == NULL) calc_##name = dummy_##name;
26f6c565bcSCarlo-Bramini 
27f6c565bcSCarlo-Bramini static HWND WINAPI
28f6c565bcSCarlo-Bramini dummy_HtmlHelpA(HWND hWnd, LPCSTR pszFile, UINT uCommand, DWORD dwData);
29f6c565bcSCarlo-Bramini 
30f6c565bcSCarlo-Bramini static HWND WINAPI
31f6c565bcSCarlo-Bramini dummy_HtmlHelpW(HWND hWnd, LPCWSTR pszFile, UINT uCommand, DWORD dwData);
32f6c565bcSCarlo-Bramini 
33f6c565bcSCarlo-Bramini type_HtmlHelpA calc_HtmlHelpA = dummy_HtmlHelpA;
34f6c565bcSCarlo-Bramini type_HtmlHelpW calc_HtmlHelpW = dummy_HtmlHelpW;
35f6c565bcSCarlo-Bramini 
36f6c565bcSCarlo-Bramini static HMODULE hHtmlHelp;
37f6c565bcSCarlo-Bramini 
38f6c565bcSCarlo-Bramini static HWND WINAPI
dummy_HtmlHelpA(HWND hWnd,LPCSTR pszFile,UINT uCommand,DWORD dwData)39f6c565bcSCarlo-Bramini dummy_HtmlHelpA(HWND hWnd, LPCSTR pszFile, UINT uCommand, DWORD dwData)
40f6c565bcSCarlo-Bramini {
41f6c565bcSCarlo-Bramini     return NULL;
42f6c565bcSCarlo-Bramini }
43f6c565bcSCarlo-Bramini 
44f6c565bcSCarlo-Bramini static HWND WINAPI
dummy_HtmlHelpW(HWND hWnd,LPCWSTR pszFile,UINT uCommand,DWORD dwData)45f6c565bcSCarlo-Bramini dummy_HtmlHelpW(HWND hWnd, LPCWSTR pszFile, UINT uCommand, DWORD dwData)
46f6c565bcSCarlo-Bramini {
47f6c565bcSCarlo-Bramini     return NULL;
48f6c565bcSCarlo-Bramini }
49f6c565bcSCarlo-Bramini 
HtmlHelp_Start(HINSTANCE hInstance)50f6c565bcSCarlo-Bramini void HtmlHelp_Start(HINSTANCE hInstance)
51f6c565bcSCarlo-Bramini {
52*055c5a9bSCarlo Bramini     hHtmlHelp = LoadLibrary(_T("HHCTRL.OCX"));
53f6c565bcSCarlo-Bramini     if (hHtmlHelp == NULL)
54f6c565bcSCarlo-Bramini         return;
55f6c565bcSCarlo-Bramini 
56f6c565bcSCarlo-Bramini     GET_CB(HtmlHelpW)
57f6c565bcSCarlo-Bramini     GET_CB(HtmlHelpA)
58f6c565bcSCarlo-Bramini }
59f6c565bcSCarlo-Bramini 
HtmlHelp_Stop(void)60f6c565bcSCarlo-Bramini void HtmlHelp_Stop(void)
61f6c565bcSCarlo-Bramini {
62f6c565bcSCarlo-Bramini     if(hHtmlHelp == NULL)
63f6c565bcSCarlo-Bramini         return;
64f6c565bcSCarlo-Bramini 
65f6c565bcSCarlo-Bramini     FreeLibrary(hHtmlHelp);
66f6c565bcSCarlo-Bramini     hHtmlHelp = NULL;
67f6c565bcSCarlo-Bramini }
68