rpn_ieee.c
utl_ieee.c
winmain.c
+ htmlhelp.c
calc.h)
file(GLOB calc_rc_deps res/*.*)
#define MAX_CALC_SIZE 256
+/* HTMLHELP SUPPORT */
+typedef HWND (WINAPI* type_HtmlHelpA)(HWND, LPCSTR, UINT, DWORD);
+typedef HWND (WINAPI* type_HtmlHelpW)(HWND, LPCWSTR, UINT, DWORD);
+
+extern type_HtmlHelpA calc_HtmlHelpA;
+extern type_HtmlHelpW calc_HtmlHelpW;
+
+#ifndef UNICODE
+#define calc_HtmlHelp calc_HtmlHelpA
+#else
+#define calc_HtmlHelp calc_HtmlHelpW
+#endif
+
+void HtmlHelp_Start(HINSTANCE hInstance);
+void HtmlHelp_Stop(void);
+
/*#define USE_KEYBOARD_HOOK*/
#define SIZEOF(_ar) (sizeof(_ar)/sizeof(_ar[1]))
--- /dev/null
+/*
+ * ReactOS Calc (HtmlHelp support)
+ *
+ * Copyright 2007-2017, Carlo Bramini
+ *
+ * This program 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 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "calc.h"
+
+#define GET_CB(name) \
+ calc_##name = (type_##name)GetProcAddress(hHtmlHelp, #name); \
+ if (calc_##name == NULL) calc_##name = dummy_##name;
+
+static HWND WINAPI
+dummy_HtmlHelpA(HWND hWnd, LPCSTR pszFile, UINT uCommand, DWORD dwData);
+
+static HWND WINAPI
+dummy_HtmlHelpW(HWND hWnd, LPCWSTR pszFile, UINT uCommand, DWORD dwData);
+
+type_HtmlHelpA calc_HtmlHelpA = dummy_HtmlHelpA;
+type_HtmlHelpW calc_HtmlHelpW = dummy_HtmlHelpW;
+
+static HMODULE hHtmlHelp;
+
+static HWND WINAPI
+dummy_HtmlHelpA(HWND hWnd, LPCSTR pszFile, UINT uCommand, DWORD dwData)
+{
+ return NULL;
+}
+
+static HWND WINAPI
+dummy_HtmlHelpW(HWND hWnd, LPCWSTR pszFile, UINT uCommand, DWORD dwData)
+{
+ return NULL;
+}
+
+void HtmlHelp_Start(HINSTANCE hInstance)
+{
+ hHtmlHelp = LoadLibrary(_T("HTMLHELP"));
+ if (hHtmlHelp == NULL)
+ return;
+
+ GET_CB(HtmlHelpW)
+ GET_CB(HtmlHelpA)
+}
+
+void HtmlHelp_Stop(void)
+{
+ if(hHtmlHelp == NULL)
+ return;
+
+ FreeLibrary(hHtmlHelp);
+ hHtmlHelp = NULL;
+}
#include "calc.h"
-#define HTMLHELP_PATH(_pt) TEXT("%systemroot%\\Help\\calc.chm::") TEXT(_pt)
+#define HTMLHELP_PATH(_pt) _T("%systemroot%\\Help\\calc.chm::") _T(_pt)
#define MAKE_BITMASK4(_show_b16, _show_b10, _show_b8, _show_b2) \
(((_show_b2) << 0) | \
popup.rcMargins.left = -1;
popup.rcMargins.right = -1;
popup.idString = GetWindowLongPtr((HWND)wp, GWL_ID);
- HtmlHelp((HWND)wp, HTMLHELP_PATH("/popups.txt"), HH_DISPLAY_TEXT_POPUP, (DWORD_PTR)&popup);
+ calc_HtmlHelp((HWND)wp, HTMLHELP_PATH("/popups.txt"), HH_DISPLAY_TEXT_POPUP, (DWORD_PTR)&popup);
}
#else
(void)idm;
return SubclassButtonProc(hWnd, wp, lp);
case WM_INITDIALOG:
- // For now, the Help dialog is disabled because of lacking of HTML Help support
+#ifdef DISABLE_HTMLHELP_SUPPORT
EnableMenuItem(GetMenu(hWnd), IDM_HELP_HELP, MF_BYCOMMAND | MF_GRAYED);
+#endif
calc.hWnd=hWnd;
#ifdef USE_KEYBOARD_HOOK
}
case IDM_HELP_HELP:
#ifndef DISABLE_HTMLHELP_SUPPORT
- HtmlHelp(hWnd, HTMLHELP_PATH("/general_information.htm"), HH_DISPLAY_TOPIC, (DWORD_PTR)NULL);
+ calc_HtmlHelp(hWnd, HTMLHELP_PATH("/general_information.htm"), HH_DISPLAY_TOPIC, (DWORD_PTR)NULL);
#endif
return TRUE;
case IDM_VIEW_STANDARD:
calc.action = IDC_STATIC;
DestroyWindow(hWnd);
return TRUE;
+
case WM_DESTROY:
/* Get (x,y) position of the calculator */
GetWindowRect(hWnd, &rc);
load_config();
start_rpn_engine();
+ HtmlHelp_Start(hInstance);
+
do {
/* ignore hwnd: dialogs are already visible! */
if (calc.layout == CALC_LAYOUT_SCIENTIFIC)
stop_rpn_engine();
+ HtmlHelp_Stop();
+
return 0;
}