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