ReactOS 0.4.16-dev-197-g92996da
winhelp.c File Reference
#include <assert.h>
#include <stdio.h>
#include <string.h>
#include <stdarg.h>
#include <stdlib.h>
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
#include "commdlg.h"
#include "winhelp.h"
#include "winhelp_res.h"
#include "shellapi.h"
#include "richedit.h"
#include "commctrl.h"
#include "wine/debug.h"
Include dependency graph for winhelp.c:

Go to the source code of this file.

Classes

struct  WINHELP
 
struct  index_data
 

Macros

#define NONAMELESSUNION
 
#define CTL_ID_BUTTON   0x700
 
#define CTL_ID_TEXT   0x701
 

Typedefs

typedef struct WINHELPLPWINHELP
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (winhelp)
 
static void WINHELP_InitFonts (HWND hWnd)
 
static DWORD CALLBACK WINHELP_RtfStreamIn (DWORD_PTR cookie, BYTE *buff, LONG cb, LONG *pcb)
 
static void WINHELP_SetupText (HWND hTextWnd, WINHELP_WINDOW *win, ULONG relative)
 
BOOL WINHELP_GetOpenFileName (LPSTR lpszFile, int len)
 
static INT WINHELP_MessageBoxIDS_s (UINT ids_text, LPCSTR str, UINT ids_title, WORD type)
 
HLPFILEWINHELP_LookupHelpFile (LPCSTR lpszFile)
 
HLPFILE_WINDOWINFOWINHELP_GetWindowInfo (HLPFILE *hlpfile, LPCSTR name)
 
static HLPFILE_WINDOWINFOWINHELP_GetPopupWindowInfo (HLPFILE *hlpfile, WINHELP_WINDOW *parent, LPARAM mouse)
 
static BOOL WINHELP_HasWorkingWindow (void)
 
static LRESULT WINHELP_HandleCommand (HWND hSrcWnd, LPARAM lParam)
 
void WINHELP_LayoutMainWindow (WINHELP_WINDOW *win)
 
static void WINHELP_DeleteButtons (WINHELP_WINDOW *win)
 
void WINHELP_DeleteBackSet (WINHELP_WINDOW *win)
 
static void WINHELP_DeletePageLinks (HLPFILE_PAGE *page)
 
WINHELP_WINDOWWINHELP_GrabWindow (WINHELP_WINDOW *win)
 
BOOL WINHELP_ReleaseWindow (WINHELP_WINDOW *win)
 
static void WINHELP_DeleteWindow (WINHELP_WINDOW *win)
 
static charWINHELP_GetCaption (WINHELP_WNDPAGE *wpage)
 
static void WINHELP_RememberPage (WINHELP_WINDOW *win, WINHELP_WNDPAGE *wpage)
 
static HLPFILE_LINKWINHELP_FindLink (WINHELP_WINDOW *win, LPARAM pos)
 
static LRESULT CALLBACK WINHELP_RicheditWndProc (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
 
BOOL WINHELP_CreateHelpWindow (WINHELP_WNDPAGE *wpage, int nCmdShow, BOOL remember)
 
BOOL WINHELP_OpenHelpWindow (HLPFILE_PAGE *(*lookup)(HLPFILE *, LONG, ULONG *), HLPFILE *hlpfile, LONG val, HLPFILE_WINDOWINFO *wi, int nCmdShow)
 
static BOOL WINHELP_HandleTextMouse (WINHELP_WINDOW *win, UINT msg, LPARAM lParam)
 
static BOOL WINHELP_CheckPopup (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, LRESULT *lret)
 
static LRESULT CALLBACK WINHELP_ButtonWndProc (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
 
static LRESULT CALLBACK WINHELP_ButtonBoxWndProc (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
 
static LRESULT CALLBACK WINHELP_HistoryWndProc (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
 
static void cb_KWBTree (void *p, void **next, void *cookie)
 
static INT_PTR CALLBACK WINHELP_IndexDlgProc (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
 
static INT_PTR CALLBACK WINHELP_SearchDlgProc (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
 
static LRESULT CALLBACK WINHELP_MainWndProc (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
 
BOOL WINHELP_CreateIndexWindow (BOOL is_search)
 
static BOOL WINHELP_RegisterWinClasses (void)
 
int PASCAL WinMain (HINSTANCE hInstance, HINSTANCE prev, LPSTR cmdline, int show)
 

Variables

WINHELP_GLOBALS Globals = {3, NULL, TRUE, NULL, NULL, NULL, NULL, NULL, {{{NULL,NULL}},0}, NULL}
 

Macro Definition Documentation

◆ CTL_ID_BUTTON

#define CTL_ID_BUTTON   0x700

Definition at line 50 of file winhelp.c.

◆ CTL_ID_TEXT

#define CTL_ID_TEXT   0x701

Definition at line 51 of file winhelp.c.

◆ NONAMELESSUNION

#define NONAMELESSUNION

Definition at line 31 of file winhelp.c.

Typedef Documentation

◆ LPWINHELP

Function Documentation

◆ cb_KWBTree()

static void cb_KWBTree ( void p,
void **  next,
void cookie 
)
static

Definition at line 1206 of file winhelp.c.

1207{
1208 HWND hListWnd = cookie;
1209 int count;
1210
1211 WINE_TRACE("Adding %s to search list\n", debugstr_a((char *)p));
1212 SendMessageA(hListWnd, LB_INSERTSTRING, -1, (LPARAM)p);
1213 count = SendMessageW(hListWnd, LB_GETCOUNT, 0, 0);
1214 SendMessageW(hListWnd, LB_SETITEMDATA, count-1, (LPARAM)p);
1215 *next = (char*)p + strlen((char*)p) + 7;
1216}
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLfloat GLfloat p
Definition: glext.h:8902
#define debugstr_a
Definition: kernel32.h:31
static unsigned __int64 next
Definition: rand_nt.c:6
#define WINE_TRACE
Definition: debug.h:354
Definition: cookie.c:34
LONG_PTR LPARAM
Definition: windef.h:208
#define LB_GETCOUNT
Definition: winuser.h:2041
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define LB_INSERTSTRING
Definition: winuser.h:2056
#define LB_SETITEMDATA
Definition: winuser.h:2068
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)

Referenced by WINHELP_IndexDlgProc().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( winhelp  )

◆ WINHELP_ButtonBoxWndProc()

static LRESULT CALLBACK WINHELP_ButtonBoxWndProc ( HWND  hWnd,
UINT  msg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 1026 of file winhelp.c.

1027{
1028 WINDOWPOS *winpos;
1031 SIZE button_size;
1032 INT x, y;
1033
1034 if (WINHELP_CheckPopup(hWnd, msg, wParam, lParam, NULL)) return 0L;
1035
1036 switch (msg)
1037 {
1039 winpos = (WINDOWPOS*) lParam;
1041
1042 /* Update buttons */
1043 button_size.cx = 0;
1044 button_size.cy = 0;
1045 for (button = win->first_button; button; button = button->next)
1046 {
1047 HDC hDc;
1048 SIZE textsize;
1049 if (!button->hWnd)
1050 {
1051 button->hWnd = CreateWindowA(STRING_BUTTON, button->lpszName,
1053 0, 0, 0, 0,
1054 hWnd, (HMENU) button->wParam,
1055 Globals.hInstance, 0);
1056 if (button->hWnd)
1057 {
1058 if (Globals.button_proc == NULL)
1059 {
1060 NONCLIENTMETRICSW ncm;
1062
1063 ncm.cbSize = sizeof(NONCLIENTMETRICSW);
1064 SystemParametersInfoW(SPI_GETNONCLIENTMETRICS,
1065 sizeof(NONCLIENTMETRICSW), &ncm, 0);
1066 Globals.hButtonFont = CreateFontIndirectW(&ncm.lfMenuFont);
1067 }
1069 if (Globals.hButtonFont)
1071 }
1072 }
1073 hDc = GetDC(button->hWnd);
1074 GetTextExtentPointA(hDc, button->lpszName, strlen(button->lpszName), &textsize);
1075 ReleaseDC(button->hWnd, hDc);
1076
1077 button_size.cx = max(button_size.cx, textsize.cx + BUTTON_CX);
1078 button_size.cy = max(button_size.cy, textsize.cy + BUTTON_CY);
1079 }
1080
1081 x = 0;
1082 y = 0;
1083 for (button = win->first_button; button; button = button->next)
1084 {
1085 SetWindowPos(button->hWnd, HWND_TOP, x, y, button_size.cx, button_size.cy, 0);
1086
1087 if (x + 2 * button_size.cx <= winpos->cx)
1088 x += button_size.cx;
1089 else
1090 x = 0, y += button_size.cy;
1091 }
1092 winpos->cy = y + (x ? button_size.cy : 0);
1093 break;
1094
1095 case WM_COMMAND:
1097 break;
1098
1099 case WM_KEYDOWN:
1100 switch (wParam)
1101 {
1102 case VK_UP:
1103 case VK_DOWN:
1104 case VK_PRIOR:
1105 case VK_NEXT:
1106 case VK_ESCAPE:
1108 }
1109 break;
1110 }
1111
1112 return DefWindowProcA(hWnd, msg, wParam, lParam);
1113}
#define msg(x)
Definition: auth_time.c:54
HWND hWnd
Definition: settings.c:17
const char STRING_BUTTON[]
Definition: string.c:26
static LRESULT CALLBACK WINHELP_ButtonWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
Definition: winhelp.c:1002
static BOOL WINHELP_CheckPopup(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, LRESULT *lret)
Definition: winhelp.c:954
WINHELP_GLOBALS Globals
Definition: winhelp.c:48
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
static real win[4][36]
DWORD button
Definition: button.c:166
static HDC
Definition: imagelist.c:88
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:63
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
#define L(x)
Definition: ntvdm.h:50
#define WS_CHILD
Definition: pedump.c:617
#define WS_VISIBLE
Definition: pedump.c:620
#define BS_PUSHBUTTON
Definition: pedump.c:651
HANDLE hInstance
Definition: winhelp.h:133
WNDPROC button_proc
Definition: winhelp.h:138
HFONT hButtonFont
Definition: winhelp.h:141
LONG cx
Definition: kdterminal.h:27
LONG cy
Definition: kdterminal.h:28
#define max(a, b)
Definition: svc.c:63
#define GWLP_WNDPROC
Definition: treelist.c:66
int32_t INT
Definition: typedefs.h:58
UINT_PTR WPARAM
Definition: windef.h:207
HFONT WINAPI CreateFontIndirectW(_In_ const LOGFONTW *)
BOOL WINAPI GetTextExtentPointA(_In_ HDC hdc, _In_reads_(c) LPCSTR lpString, _In_ int c, _Out_ LPSIZE lpsz)
#define BUTTON_CY
Definition: winhelp.h:33
#define BUTTON_CX
Definition: winhelp.h:32
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
#define SetWindowLongPtrA
Definition: winuser.h:5357
#define GetWindowLongPtrW
Definition: winuser.h:4832
LRESULT WINAPI DefWindowProcA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define WM_WINDOWPOSCHANGING
Definition: winuser.h:1664
#define CreateWindowA(a, b, c, d, e, f, g, h, i, j, k)
Definition: winuser.h:4318
BOOL WINAPI SetWindowPos(_In_ HWND, _In_opt_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ UINT)
#define WM_COMMAND
Definition: winuser.h:1743
#define VK_UP
Definition: winuser.h:2228
#define GetWindowLongPtrA
Definition: winuser.h:4831
#define VK_NEXT
Definition: winuser.h:2224
#define HWND_TOP
Definition: winuser.h:1210
#define WM_SETFONT
Definition: winuser.h:1653
HDC WINAPI GetDC(_In_opt_ HWND)
BOOL WINAPI SystemParametersInfoW(_In_ UINT uiAction, _In_ UINT uiParam, _Inout_opt_ PVOID pvParam, _In_ UINT fWinIni)
HWND WINAPI GetParent(_In_ HWND)
#define VK_DOWN
Definition: winuser.h:2230
#define VK_PRIOR
Definition: winuser.h:2223
#define WM_KEYDOWN
Definition: winuser.h:1718
LRESULT(CALLBACK * WNDPROC)(HWND, UINT, WPARAM, LPARAM)
Definition: winuser.h:2909
#define VK_ESCAPE
Definition: winuser.h:2217

Referenced by WINHELP_RegisterWinClasses().

◆ WINHELP_ButtonWndProc()

static LRESULT CALLBACK WINHELP_ButtonWndProc ( HWND  hWnd,
UINT  msg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 1002 of file winhelp.c.

1003{
1004 if (WINHELP_CheckPopup(hWnd, msg, wParam, lParam, NULL)) return 0;
1005
1006 if (msg == WM_KEYDOWN)
1007 {
1008 switch (wParam)
1009 {
1010 case VK_UP:
1011 case VK_DOWN:
1012 case VK_PRIOR:
1013 case VK_NEXT:
1014 case VK_ESCAPE:
1016 }
1017 }
1018
1020}
LRESULT WINAPI CallWindowProcA(_In_ WNDPROC, _In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)

Referenced by WINHELP_ButtonBoxWndProc().

◆ WINHELP_CheckPopup()

static BOOL WINHELP_CheckPopup ( HWND  hWnd,
UINT  msg,
WPARAM  wParam,
LPARAM  lParam,
LRESULT lret 
)
static

Definition at line 954 of file winhelp.c.

955{
956 WINHELP_WINDOW* popup;
957
958 if (!Globals.active_popup) return FALSE;
959
960 switch (msg)
961 {
962 case WM_NOTIFY:
963 {
964 MSGFILTER* msgf = (MSGFILTER*)lParam;
965 if (msgf->nmhdr.code == EN_MSGFILTER)
966 {
967 if (!WINHELP_CheckPopup(hWnd, msgf->msg, msgf->wParam, msgf->lParam, NULL))
968 return FALSE;
969 if (lret) *lret = 1;
970 return TRUE;
971 }
972 }
973 break;
974 case WM_ACTIVATE:
978 break;
979 /* fall through */
980 case WM_LBUTTONDOWN:
981 if (msg == WM_LBUTTONDOWN)
983 /* fall through */
984 case WM_MBUTTONDOWN:
985 case WM_RBUTTONDOWN:
986 case WM_NCLBUTTONDOWN:
987 case WM_NCMBUTTONDOWN:
988 case WM_NCRBUTTONDOWN:
989 popup = Globals.active_popup;
992 if (lret) *lret = 1;
993 return TRUE;
994 }
995 return FALSE;
996}
static BOOL WINHELP_HandleTextMouse(WINHELP_WINDOW *win, UINT msg, LPARAM lParam)
Definition: winhelp.c:898
BOOL WINHELP_ReleaseWindow(WINHELP_WINDOW *win)
Definition: winhelp.c:527
#define FALSE
Definition: types.h:117
HANDLE HWND
Definition: compat.h:19
#define LOWORD(l)
Definition: pedump.c:82
#define EN_MSGFILTER
Definition: richedit.h:191
#define WM_NOTIFY
Definition: richedit.h:61
WINHELP_WINDOW * active_popup
Definition: winhelp.h:136
WINHELP_WINDOW * active_win
Definition: winhelp.h:135
LPARAM lParam
Definition: richedit.h:643
NMHDR nmhdr
Definition: richedit.h:640
UINT msg
Definition: richedit.h:641
WPARAM wParam
Definition: richedit.h:642
UINT code
Definition: winuser.h:3162
HWND hMainWnd
Definition: winhelp.h:80
#define GW_OWNER
Definition: winuser.h:769
#define WA_INACTIVE
Definition: winuser.h:2625
#define WM_LBUTTONDOWN
Definition: winuser.h:1779
#define WM_ACTIVATE
Definition: winuser.h:1615
#define WM_RBUTTONDOWN
Definition: winuser.h:1782
#define WM_NCMBUTTONDOWN
Definition: winuser.h:1701
HWND WINAPI GetWindow(_In_ HWND, _In_ UINT)
#define WM_NCLBUTTONDOWN
Definition: winuser.h:1695
#define WM_MBUTTONDOWN
Definition: winuser.h:1785
#define WM_NCRBUTTONDOWN
Definition: winuser.h:1698

Referenced by WINHELP_ButtonBoxWndProc(), WINHELP_ButtonWndProc(), WINHELP_CheckPopup(), and WINHELP_MainWndProc().

◆ WINHELP_CreateHelpWindow()

BOOL WINHELP_CreateHelpWindow ( WINHELP_WNDPAGE wpage,
int  nCmdShow,
BOOL  remember 
)

Definition at line 701 of file winhelp.c.

702{
704 BOOL bPrimary, bPopup, bReUsed = FALSE;
705 HICON hIcon;
706 HWND hTextWnd = NULL;
707
708 bPrimary = !lstrcmpiA(wpage->wininfo->name, "main");
709 bPopup = !bPrimary && (wpage->wininfo->win_style & WS_POPUP);
710
711 if (!bPopup)
712 {
713 for (win = Globals.win_list; win; win = win->next)
714 {
715 if (!lstrcmpiA(win->info->name, wpage->wininfo->name))
716 {
717 if (win->page == wpage->page && win->info == wpage->wininfo)
718 {
719 /* see #22979, some hlp files have a macro (run at page opening), which
720 * jumps to the very same page
721 * Exit gracefully in that case
722 */
723 return TRUE;
724 }
726 bReUsed = TRUE;
727 SetWindowTextA(win->hMainWnd, WINHELP_GetCaption(wpage));
728 if (win->info != wpage->wininfo)
729 {
730 POINT pt = {0, 0};
731 SIZE sz = {0, 0};
733
734 if (wpage->wininfo->origin.x != CW_USEDEFAULT &&
735 wpage->wininfo->origin.y != CW_USEDEFAULT)
736 {
737 pt = wpage->wininfo->origin;
738 flags &= ~SWP_NOSIZE;
739 }
740 if (wpage->wininfo->size.cx != CW_USEDEFAULT &&
741 wpage->wininfo->size.cy != CW_USEDEFAULT)
742 {
743 sz = wpage->wininfo->size;
744 flags &= ~SWP_NOMOVE;
745 }
746 SetWindowPos(win->hMainWnd, HWND_TOP, pt.x, pt.y, sz.cx, sz.cy, flags);
747 }
748
749 if (wpage->page && win->page && wpage->page->file != win->page->file)
751 WINHELP_InitFonts(win->hMainWnd);
752
753 win->page = wpage->page;
754 win->info = wpage->wininfo;
755 hTextWnd = GetDlgItem(win->hMainWnd, CTL_ID_TEXT);
756 WINHELP_SetupText(hTextWnd, win, wpage->relative);
757
758 InvalidateRect(win->hMainWnd, NULL, TRUE);
759 if (win->hHistoryWnd) InvalidateRect(win->hHistoryWnd, NULL, TRUE);
760
761 break;
762 }
763 }
764 }
765
766 if (!win)
767 {
768 /* Initialize WINHELP_WINDOW struct */
770 if (!win) return FALSE;
771 win->next = Globals.win_list;
773
774 win->hHandCur = LoadCursorW(0, (LPWSTR)IDC_HAND);
775 win->back.index = 0;
776 win->font_scale = 1;
778 }
779 win->page = wpage->page;
780 win->info = wpage->wininfo;
782
783 if (!bPopup && wpage->page && remember)
784 {
786 }
787
788 if (bPopup)
790 else
792
793 /* Initialize default pushbuttons */
794 if (bPrimary && wpage->page)
795 {
797
799 MACRO_CreateButton("BTN_CONTENTS", buffer, "Contents()");
801 MACRO_CreateButton("BTN_INDEX", buffer, "Finder()");
803 MACRO_CreateButton("BTN_BACK", buffer, "Back()");
804 if (win->back.index <= 1) MACRO_DisableButton("BTN_BACK");
805 }
806
807 if (!bReUsed)
808 {
809 win->hMainWnd = CreateWindowExA((bPopup) ? WS_EX_TOOLWINDOW : 0, MAIN_WIN_CLASS_NAME,
810 WINHELP_GetCaption(wpage),
811 bPrimary ? WS_OVERLAPPEDWINDOW : wpage->wininfo->win_style,
812 wpage->wininfo->origin.x, wpage->wininfo->origin.y,
813 wpage->wininfo->size.cx, wpage->wininfo->size.cy,
814 bPopup ? Globals.active_win->hMainWnd : NULL,
817 if (!bPopup)
818 /* Create button box and text Window */
820 0, 0, 0, 0, win->hMainWnd, (HMENU)CTL_ID_BUTTON, Globals.hInstance, NULL);
821
824 0, 0, 0, 0, win->hMainWnd, (HMENU)CTL_ID_TEXT, Globals.hInstance, NULL);
825 SendMessageW(hTextWnd, EM_SETEVENTMASK, 0,
826 SendMessageW(hTextWnd, EM_GETEVENTMASK, 0, 0) | ENM_MOUSEEVENTS);
827 win->origRicheditWndProc = (WNDPROC)SetWindowLongPtrA(hTextWnd, GWLP_WNDPROC,
829 }
830
831 hIcon = (wpage->page) ? wpage->page->file->hIcon : NULL;
834 SendMessageW(win->hMainWnd, WM_SETICON, ICON_SMALL, (DWORD_PTR)hIcon);
835
836 /* Initialize file specific pushbuttons */
837 if (!(wpage->wininfo->win_style & WS_POPUP) && wpage->page)
838 {
839 HLPFILE_MACRO *macro;
840 for (macro = wpage->page->file->first_macro; macro; macro = macro->next)
842
843 for (macro = wpage->page->first_macro; macro; macro = macro->next)
845 }
846 /* See #17681, in some cases, the newly created window is closed by the macros it contains
847 * (braindead), so deal with this case
848 */
849 for (win = Globals.win_list; win; win = win->next)
850 {
851 if (!lstrcmpiA(win->info->name, wpage->wininfo->name)) break;
852 }
853 if (!win || !WINHELP_ReleaseWindow(win)) return TRUE;
854
855 if (bPopup)
856 {
857 DWORD mask = SendMessageW(hTextWnd, EM_GETEVENTMASK, 0, 0);
858
859 win->font_scale = Globals.active_win->font_scale;
860 WINHELP_SetupText(hTextWnd, win, wpage->relative);
861
862 /* we need the window to be shown for richedit to compute the size */
863 ShowWindow(win->hMainWnd, nCmdShow);
865 SendMessageW(hTextWnd, EM_REQUESTRESIZE, 0, 0);
866 SendMessageW(hTextWnd, EM_SETEVENTMASK, 0, mask);
867 }
868 else
869 {
870 WINHELP_SetupText(hTextWnd, win, wpage->relative);
872 ShowWindow(win->hMainWnd, nCmdShow);
873 }
874
875 return TRUE;
876}
#define MAX_STRING_LEN
Definition: precomp.h:36
#define MAIN_MENU
Definition: resources.h:12
const char MAIN_WIN_CLASS_NAME[]
Definition: string.c:23
const char BUTTON_BOX_WIN_CLASS_NAME[]
Definition: string.c:24
static void WINHELP_DeleteButtons(WINHELP_WINDOW *win)
Definition: winhelp.c:466
#define CTL_ID_TEXT
Definition: winhelp.c:51
WINHELP_WINDOW * WINHELP_GrabWindow(WINHELP_WINDOW *win)
Definition: winhelp.c:516
static char * WINHELP_GetCaption(WINHELP_WNDPAGE *wpage)
Definition: winhelp.c:589
static void WINHELP_SetupText(HWND hTextWnd, WINHELP_WINDOW *win, ULONG relative)
Definition: winhelp.c:103
static LRESULT CALLBACK WINHELP_RicheditWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
Definition: winhelp.c:673
void WINHELP_LayoutMainWindow(WINHELP_WINDOW *win)
Definition: winhelp.c:437
void WINHELP_DeleteBackSet(WINHELP_WINDOW *win)
Definition: winhelp.c:484
static void WINHELP_RememberPage(WINHELP_WINDOW *win, WINHELP_WNDPAGE *wpage)
Definition: winhelp.c:595
static void WINHELP_InitFonts(HWND hWnd)
Definition: winhelp.c:58
#define CTL_ID_BUTTON
Definition: winhelp.c:50
#define GetProcessHeap()
Definition: compat.h:736
#define HeapAlloc
Definition: compat.h:733
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
int WINAPI lstrcmpiA(LPCSTR str1, LPCSTR str2)
Definition: locale.c:4224
#define pt(x, y)
Definition: drawing.c:79
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
GLuint buffer
Definition: glext.h:5915
GLenum GLint GLuint mask
Definition: glext.h:6028
GLbitfield flags
Definition: glext.h:7161
if(dx< 0)
Definition: linetemp.h:194
void CALLBACK MACRO_CreateButton(LPCSTR id, LPCSTR name, LPCSTR macro)
Definition: macro.c:73
void CALLBACK MACRO_DisableButton(LPCSTR id)
Definition: macro.c:116
BOOL MACRO_ExecuteMacro(struct tagWinHelp *, LPCSTR)
static HICON
Definition: imagelist.c:80
HICON hIcon
Definition: msconfig.c:44
#define WS_OVERLAPPEDWINDOW
Definition: pedump.c:637
#define ES_READONLY
Definition: pedump.c:675
#define WS_POPUP
Definition: pedump.c:616
#define WS_VSCROLL
Definition: pedump.c:627
#define WS_HSCROLL
Definition: pedump.c:628
#define ES_MULTILINE
Definition: pedump.c:667
#define EM_GETEVENTMASK
Definition: richedit.h:92
#define EM_REQUESTRESIZE
Definition: richedit.h:98
#define EM_SETEVENTMASK
Definition: richedit.h:102
#define RICHEDIT_CLASS20A
Definition: richedit.h:43
#define ENM_REQUESTRESIZE
Definition: richedit.h:477
#define ENM_MOUSEEVENTS
Definition: richedit.h:476
char name[9]
Definition: hlpfile.h:30
WINHELP_WINDOW * win_list
Definition: winhelp.h:137
ULONG relative
Definition: winhelp.h:64
HLPFILE_WINDOWINFO * wininfo
Definition: winhelp.h:63
HLPFILE_PAGE * page
Definition: winhelp.h:62
LPCSTR lpszMacro
Definition: hlpfile.h:64
struct tagHlpFileMacro * next
Definition: hlpfile.h:65
HLPFILE_MACRO * first_macro
Definition: hlpfile.h:71
struct tagHlpFileFile * file
Definition: hlpfile.h:84
long y
Definition: polytest.cpp:48
long x
Definition: polytest.cpp:48
unsigned font_scale
Definition: winhelp.h:95
#define ICON_SMALL
Definition: tnclass.cpp:48
uint32_t DWORD_PTR
Definition: typedefs.h:65
#define STID_BACK
Definition: winhelp_res.h:44
#define STID_INDEX
Definition: winhelp_res.h:43
#define IDI_WINHELP
Definition: winhelp_res.h:56
#define STID_CONTENTS
Definition: winhelp_res.h:42
BOOL WINAPI SetWindowTextA(_In_ HWND, _In_opt_ LPCSTR)
HWND WINAPI CreateWindowExA(_In_ DWORD dwExStyle, _In_opt_ LPCSTR lpClassName, _In_opt_ LPCSTR lpWindowName, _In_ DWORD dwStyle, _In_ int X, _In_ int Y, _In_ int nWidth, _In_ int nHeight, _In_opt_ HWND hWndParent, _In_opt_ HMENU hMenu, _In_opt_ HINSTANCE hInstance, _In_opt_ LPVOID lpParam)
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
#define IMAGE_ICON
Definition: winuser.h:212
#define SWP_NOMOVE
Definition: winuser.h:1247
HANDLE WINAPI LoadImageW(_In_opt_ HINSTANCE hInst, _In_ LPCWSTR name, _In_ UINT type, _In_ int cx, _In_ int cy, _In_ UINT fuLoad)
Definition: cursoricon.c:2255
#define WS_EX_TOOLWINDOW
Definition: winuser.h:404
#define SM_CYSMICON
Definition: winuser.h:1016
#define SWP_NOSIZE
Definition: winuser.h:1248
int WINAPI LoadStringA(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPSTR lpBuffer, _In_ int cchBufferMax)
HCURSOR WINAPI LoadCursorW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
Definition: cursoricon.c:2157
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define SM_CXSMICON
Definition: winuser.h:1015
#define LR_SHARED
Definition: winuser.h:1103
#define CW_USEDEFAULT
Definition: winuser.h:225
#define IDC_HAND
Definition: winuser.h:698
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
HMENU WINAPI LoadMenuW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
int WINAPI GetSystemMetrics(_In_ int)
WCHAR * LPWSTR
Definition: xmlstorage.h:184
char CHAR
Definition: xmlstorage.h:175

Referenced by MACRO_Back(), MACRO_Next(), MACRO_Prev(), WINHELP_HistoryWndProc(), and WINHELP_OpenHelpWindow().

◆ WINHELP_CreateIndexWindow()

BOOL WINHELP_CreateIndexWindow ( BOOL  is_search)

Definition at line 1545 of file winhelp.c.

1546{
1547 HPROPSHEETPAGE psPage[3];
1548 PROPSHEETPAGEA psp;
1549 PROPSHEETHEADERA psHead;
1550 struct index_data id;
1551 char buf[256];
1552
1555 else
1556 return FALSE;
1557
1558 if (id.hlpfile->kwbtree == NULL)
1559 {
1560 WINE_TRACE("No index provided\n");
1561 return FALSE;
1562 }
1563
1565
1566 id.jump = FALSE;
1567 memset(&psp, 0, sizeof(psp));
1568 psp.dwSize = sizeof(psp);
1569 psp.dwFlags = 0;
1571
1573 psp.lParam = (LPARAM)&id;
1575 psPage[0] = CreatePropertySheetPageA(&psp);
1576
1578 psp.lParam = (LPARAM)&id;
1580 psPage[1] = CreatePropertySheetPageA(&psp);
1581
1582 memset(&psHead, 0, sizeof(psHead));
1583 psHead.dwSize = sizeof(psHead);
1584
1587
1588 psHead.pszCaption = buf;
1589 psHead.nPages = 2;
1590 psHead.u2.nStartPage = is_search ? 1 : 0;
1592 psHead.u3.phpage = psPage;
1593 psHead.dwFlags = PSH_NOAPPLYNOW;
1594
1595 PropertySheetA(&psHead);
1596 if (id.jump)
1597 {
1598 WINE_TRACE("got %d as an offset\n", id.offset);
1601 }
1602 return TRUE;
1603}
char * strcat(char *DstString, const char *SrcString)
Definition: utclib.c:568
BOOL WINHELP_OpenHelpWindow(HLPFILE_PAGE *(*lookup)(HLPFILE *, LONG, ULONG *), HLPFILE *hlpfile, LONG val, HLPFILE_WINDOWINFO *wi, int nCmdShow)
Definition: winhelp.c:882
static INT_PTR CALLBACK WINHELP_SearchDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
Definition: winhelp.c:1296
static INT_PTR CALLBACK WINHELP_IndexDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
Definition: winhelp.c:1229
VOID WINAPI InitCommonControls(void)
Definition: commctrl.c:870
INT_PTR WINAPI PropertySheetA(LPCPROPSHEETHEADERA lppsh)
Definition: propsheet.c:2875
HPROPSHEETPAGE WINAPI CreatePropertySheetPageA(LPCPROPSHEETPAGEA lpPropSheetPage)
Definition: propsheet.c:3002
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
GLuint id
Definition: glext.h:5910
GLintptr offset
Definition: glext.h:5920
HLPFILE_PAGE * HLPFILE_PageByOffset(HLPFILE *hlpfile, LONG offset, ULONG *relative)
Definition: hlpfile.c:369
struct _PSP * HPROPSHEETPAGE
Definition: mstask.idl:90
#define PSH_NOAPPLYNOW
Definition: prsht.h:47
#define memset(x, y, z)
Definition: compat.h:39
char caption[51]
Definition: hlpfile.h:31
DWORD dwFlags
Definition: prsht.h:259
DWORD dwSize
Definition: prsht.h:258
HWND hwndParent
Definition: prsht.h:260
UINT nStartPage
Definition: prsht.h:269
HPROPSHEETPAGE * phpage
Definition: prsht.h:274
LPCSTR pszCaption
Definition: prsht.h:266
DWORD dwFlags
Definition: prsht.h:178
LPCSTR pszTemplate
Definition: prsht.h:181
HINSTANCE hInstance
Definition: prsht.h:179
LPARAM lParam
Definition: prsht.h:190
DLGPROC pfnDlgProc
Definition: prsht.h:189
DWORD dwSize
Definition: prsht.h:177
HLPFILE * hlpfile
Definition: winhelp.c:1220
BOOL jump
Definition: winhelp.c:1221
BYTE * kwbtree
Definition: hlpfile.h:111
HLPFILE_PAGE * page
Definition: winhelp.h:78
HLPFILE_WINDOWINFO * info
Definition: winhelp.h:92
#define STID_PSH_INDEX
Definition: winhelp_res.h:50
#define IDD_SEARCH
Definition: winhelp_res.h:54
#define IDD_INDEX
Definition: winhelp_res.h:52
#define MAKEINTRESOURCEA(i)
Definition: winuser.h:581
#define SW_NORMAL
Definition: winuser.h:772

Referenced by MACRO_Finder(), and MACRO_Search().

◆ WINHELP_DeleteBackSet()

void WINHELP_DeleteBackSet ( WINHELP_WINDOW win)

Definition at line 484 of file winhelp.c.

485{
486 unsigned int i;
487
488 for (i = 0; i < win->back.index; i++)
489 {
490 HLPFILE_FreeHlpFile(win->back.set[i].page->file);
491 win->back.set[i].page = NULL;
492 }
493 win->back.index = 0;
494}
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
void HLPFILE_FreeHlpFile(HLPFILE *hlpfile)
Definition: hlpfile.c:2297

Referenced by MACRO_BackFlush(), WINHELP_CreateHelpWindow(), and WINHELP_DeleteWindow().

◆ WINHELP_DeleteButtons()

static void WINHELP_DeleteButtons ( WINHELP_WINDOW win)
static

Definition at line 466 of file winhelp.c.

467{
469 WINHELP_BUTTON* bp;
470
471 for (b = win->first_button; b; b = bp)
472 {
473 DestroyWindow(b->hWnd);
474 bp = b->next;
476 }
477 win->first_button = NULL;
478}
#define HeapFree(x, y, z)
Definition: compat.h:735
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
#define b
Definition: ke_i.h:79
struct tagHelpButton * next
Definition: winhelp.h:57
BOOL WINAPI DestroyWindow(_In_ HWND)

Referenced by WINHELP_CreateHelpWindow(), and WINHELP_DeleteWindow().

◆ WINHELP_DeletePageLinks()

static void WINHELP_DeletePageLinks ( HLPFILE_PAGE page)
static

Definition at line 500 of file winhelp.c.

501{
502 HLPFILE_LINK* curr;
504
505 for (curr = page->first_link; curr; curr = next)
506 {
507 next = curr->next;
508 HeapFree(GetProcessHeap(), 0, curr);
509 }
510}
Definition: module.h:576

Referenced by WINHELP_DeleteWindow().

◆ WINHELP_DeleteWindow()

static void WINHELP_DeleteWindow ( WINHELP_WINDOW win)
static

Definition at line 543 of file winhelp.c.

544{
546 BOOL bExit;
547 HWND hTextWnd;
548
549 for (w = &Globals.win_list; *w; w = &(*w)->next)
550 {
551 if (*w == win)
552 {
553 *w = win->next;
554 break;
555 }
556 }
557 bExit = (Globals.wVersion >= 4 && !lstrcmpiA(win->info->name, "main"));
558
559 if (Globals.active_win == win)
560 {
562 if (Globals.win_list)
564 }
565
566 if (win == Globals.active_popup)
568
569 hTextWnd = GetDlgItem(win->hMainWnd, CTL_ID_TEXT);
570 SetWindowLongPtrA(hTextWnd, GWLP_WNDPROC, (LONG_PTR)win->origRicheditWndProc);
571
573
574 if (win->page) WINHELP_DeletePageLinks(win->page);
575 if (win->hHistoryWnd) DestroyWindow(win->hHistoryWnd);
576
577 DeleteObject(win->hBrush);
578
580
581 if (win->page) HLPFILE_FreeHlpFile(win->page->file);
583
584 if (bExit) MACRO_Exit();
585 if (!Globals.win_list)
587}
static void WINHELP_DeletePageLinks(HLPFILE_PAGE *page)
Definition: winhelp.c:500
BOOL bExit
Definition: cmd.c:152
pKey DeleteObject()
GLubyte GLubyte GLubyte GLubyte w
Definition: glext.h:6102
void CALLBACK MACRO_Exit(void)
Definition: macro.c:392
struct tagWinHelp * next
Definition: winhelp.h:97
__analysis_noreturn void WINAPI PostQuitMessage(_In_ int)
HWND WINAPI SetActiveWindow(_In_ HWND)

Referenced by WINHELP_MainWndProc().

◆ WINHELP_FindLink()

static HLPFILE_LINK * WINHELP_FindLink ( WINHELP_WINDOW win,
LPARAM  pos 
)
static

Definition at line 633 of file winhelp.c.

634{
636 POINTL mouse_ptl, char_ptl, char_next_ptl;
637 DWORD cp;
638
639 if (!win->page) return NULL;
640
641 mouse_ptl.x = (short)LOWORD(pos);
642 mouse_ptl.y = (short)HIWORD(pos);
644 0, (LPARAM)&mouse_ptl);
645
646 for (link = win->page->first_link; link; link = link->next)
647 {
648 if (link->cpMin <= cp && cp <= link->cpMax)
649 {
650 /* check whether we're at end of line */
652 (LPARAM)&char_ptl, cp);
654 (LPARAM)&char_next_ptl, cp + 1);
655 if (link->bHotSpot)
656 {
658 if ((mouse_ptl.x < char_ptl.x + hslink->x) ||
659 (mouse_ptl.x >= char_ptl.x + hslink->x + hslink->width) ||
660 (mouse_ptl.y < char_ptl.y + hslink->y) ||
661 (mouse_ptl.y >= char_ptl.y + hslink->y + hslink->height))
662 continue;
663 break;
664 }
665 if (char_next_ptl.y != char_ptl.y || mouse_ptl.x >= char_next_ptl.x)
666 link = NULL;
667 break;
668 }
669 }
670 return link;
671}
const WCHAR * link
Definition: db.cpp:997
unsigned short(__cdecl typeof(TIFFCurrentDirectory))(struct tiff *)
Definition: typeof.h:94
POINT cp
Definition: magnifier.c:59
#define EM_POSFROMCHAR
Definition: richedit.h:77
#define EM_CHARFROMPOS
Definition: richedit.h:78
LONG y
Definition: windef.h:330
LONG x
Definition: windef.h:329
#define HIWORD(l)
Definition: typedefs.h:247

Referenced by WINHELP_HandleTextMouse(), and WINHELP_RicheditWndProc().

◆ WINHELP_GetCaption()

static char * WINHELP_GetCaption ( WINHELP_WNDPAGE wpage)
static

Definition at line 589 of file winhelp.c.

590{
591 if (wpage->wininfo->caption[0]) return wpage->wininfo->caption;
592 return wpage->page->file->lpszTitle;
593}

Referenced by WINHELP_CreateHelpWindow().

◆ WINHELP_GetOpenFileName()

BOOL WINHELP_GetOpenFileName ( LPSTR  lpszFile,
int  len 
)

Definition at line 145 of file winhelp.c.

146{
147 OPENFILENAMEA openfilename;
148 CHAR szDir[MAX_PATH];
149 CHAR szzFilter[2 * MAX_STRING_LEN + 100];
150 LPSTR p = szzFilter;
151
152 WINE_TRACE("()\n");
153
155 p += strlen(p) + 1;
156 strcpy(p, "*.hlp");
157 p += strlen(p) + 1;
159 p += strlen(p) + 1;
160 strcpy(p, "*.*");
161 p += strlen(p) + 1;
162 *p = '\0';
163
164 GetCurrentDirectoryA(sizeof(szDir), szDir);
165
166 lpszFile[0]='\0';
167
168 openfilename.lStructSize = sizeof(openfilename);
169 openfilename.hwndOwner = (Globals.active_win ? Globals.active_win->hMainWnd : 0);
170 openfilename.hInstance = Globals.hInstance;
171 openfilename.lpstrFilter = szzFilter;
172 openfilename.lpstrCustomFilter = 0;
173 openfilename.nMaxCustFilter = 0;
174 openfilename.nFilterIndex = 1;
175 openfilename.lpstrFile = lpszFile;
176 openfilename.nMaxFile = len;
177 openfilename.lpstrFileTitle = 0;
178 openfilename.nMaxFileTitle = 0;
179 openfilename.lpstrInitialDir = szDir;
180 openfilename.lpstrTitle = 0;
182 openfilename.nFileOffset = 0;
183 openfilename.nFileExtension = 0;
184 openfilename.lpstrDefExt = 0;
185 openfilename.lCustData = 0;
186 openfilename.lpfnHook = 0;
187 openfilename.lpTemplateName = 0;
188
189 return GetOpenFileNameA(&openfilename);
190}
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
#define OFN_EXPLORER
Definition: commdlg.h:104
#define OFN_HIDEREADONLY
Definition: commdlg.h:107
#define OFN_ENABLESIZING
Definition: commdlg.h:101
#define OFN_READONLY
Definition: commdlg.h:118
BOOL WINAPI GetOpenFileNameA(OPENFILENAMEA *ofn)
Definition: filedlg.c:4701
#define MAX_PATH
Definition: compat.h:34
DWORD WINAPI GetCurrentDirectoryA(IN DWORD nBufferLength, OUT LPSTR lpBuffer)
Definition: path.c:2146
GLenum GLsizei len
Definition: glext.h:6722
LPARAM lCustData
Definition: commdlg.h:346
LPCSTR lpstrDefExt
Definition: commdlg.h:345
DWORD nMaxCustFilter
Definition: commdlg.h:334
LPSTR lpstrFileTitle
Definition: commdlg.h:338
LPCSTR lpTemplateName
Definition: commdlg.h:348
LPSTR lpstrCustomFilter
Definition: commdlg.h:333
DWORD nFilterIndex
Definition: commdlg.h:335
HWND hwndOwner
Definition: commdlg.h:330
LPCSTR lpstrTitle
Definition: commdlg.h:341
HINSTANCE hInstance
Definition: commdlg.h:331
WORD nFileExtension
Definition: commdlg.h:344
LPSTR lpstrFile
Definition: commdlg.h:336
DWORD nMaxFileTitle
Definition: commdlg.h:339
DWORD Flags
Definition: commdlg.h:342
WORD nFileOffset
Definition: commdlg.h:343
LPCSTR lpstrInitialDir
Definition: commdlg.h:340
LPOFNHOOKPROC lpfnHook
Definition: commdlg.h:347
DWORD lStructSize
Definition: commdlg.h:329
LPCSTR lpstrFilter
Definition: commdlg.h:332
DWORD nMaxFile
Definition: commdlg.h:337
#define STID_HELP_FILES_HLP
Definition: winhelp_res.h:46
#define STID_ALL_FILES
Definition: winhelp_res.h:45
char * LPSTR
Definition: xmlstorage.h:182

Referenced by MACRO_FileOpen(), and WINHELP_LookupHelpFile().

◆ WINHELP_GetPopupWindowInfo()

static HLPFILE_WINDOWINFO * WINHELP_GetPopupWindowInfo ( HLPFILE hlpfile,
WINHELP_WINDOW parent,
LPARAM  mouse 
)
static

Definition at line 302 of file winhelp.c.

304{
305 static HLPFILE_WINDOWINFO wi;
306
307 RECT parent_rect;
308
309 wi.type[0] = wi.name[0] = wi.caption[0] = '\0';
310
311 /* Calculate horizontal size and position of a popup window */
312 GetWindowRect(parent->hMainWnd, &parent_rect);
313 wi.size.cx = (parent_rect.right - parent_rect.left) / 2;
314 wi.size.cy = 10; /* need a non null value, so that borders are taken into account while computing */
315
316 wi.origin.x = (short)LOWORD(mouse);
317 wi.origin.y = (short)HIWORD(mouse);
318 ClientToScreen(parent->hMainWnd, &wi.origin);
319 wi.origin.x -= wi.size.cx / 2;
321 wi.origin.x = max(wi.origin.x, 0);
322
323 wi.style = SW_SHOW;
325 if (parent->page->file->has_popup_color)
326 wi.sr_color = parent->page->file->popup_color;
327 else
328 wi.sr_color = parent->info->sr_color;
329 wi.nsr_color = 0xFFFFFF;
330
331 return &wi;
332}
r parent
Definition: btrfs.c:3010
#define min(a, b)
Definition: monoChain.cc:55
#define WS_BORDER
Definition: pedump.c:625
char type[10]
Definition: hlpfile.h:29
COLORREF nsr_color
Definition: hlpfile.h:37
COLORREF sr_color
Definition: hlpfile.h:36
LONG right
Definition: windef.h:308
LONG left
Definition: windef.h:306
BOOL WINAPI GetWindowRect(_In_ HWND, _Out_ LPRECT)
BOOL WINAPI ClientToScreen(_In_ HWND, _Inout_ LPPOINT)
#define SW_SHOW
Definition: winuser.h:778
#define SM_CXSCREEN
Definition: winuser.h:962

Referenced by WINHELP_HandleTextMouse().

◆ WINHELP_GetWindowInfo()

HLPFILE_WINDOWINFO * WINHELP_GetWindowInfo ( HLPFILE hlpfile,
LPCSTR  name 
)

Definition at line 253 of file winhelp.c.

254{
255 static HLPFILE_WINDOWINFO mwi;
256 unsigned int i;
257
258 if (!name || !name[0])
260
261 if (hlpfile)
262 for (i = 0; i < hlpfile->numWindows; i++)
263 if (!lstrcmpiA(hlpfile->windows[i].name, name))
264 return &hlpfile->windows[i];
265
266 if (strcmp(name, "main") != 0)
267 {
268 WINE_FIXME("Couldn't find window info for %s\n", debugstr_a(name));
269 assert(0);
270 return NULL;
271 }
272 if (!mwi.name[0])
273 {
274 strcpy(mwi.type, "primary");
275 strcpy(mwi.name, "main");
276 if (hlpfile && hlpfile->lpszTitle[0])
277#ifdef __REACTOS__
278 snprintf(mwi.caption, sizeof(mwi.caption), "%s", hlpfile->lpszTitle);
279#else
280 {
281 char tmp[128];
282 LoadStringA(Globals.hInstance, STID_WINE_HELP, tmp, sizeof(tmp));
283 snprintf(mwi.caption, sizeof(mwi.caption), "%s %s - %s",
284 hlpfile->lpszTitle, tmp, hlpfile->lpszPath);
285 }
286#endif
287 else
289 mwi.origin.x = mwi.origin.y = mwi.size.cx = mwi.size.cy = CW_USEDEFAULT;
290 mwi.style = SW_SHOW;
292 mwi.sr_color = mwi.nsr_color = 0xFFFFFF;
293 }
294 return &mwi;
295}
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
#define assert(x)
Definition: debug.h:53
#define WINE_FIXME
Definition: debug.h:366
Definition: name.c:39
LPSTR lpszTitle
Definition: hlpfile.h:105
HLPFILE_WINDOWINFO * windows
Definition: hlpfile.h:147
unsigned numWindows
Definition: hlpfile.h:146
LPSTR lpszPath
Definition: hlpfile.h:104
#define STID_WINE_HELP
Definition: winhelp_res.h:36
#define snprintf
Definition: wintirpc.h:48

Referenced by MACRO_JumpContents(), MACRO_JumpContext(), MACRO_JumpHash(), and WinMain().

◆ WINHELP_GrabWindow()

WINHELP_WINDOW * WINHELP_GrabWindow ( WINHELP_WINDOW win)

Definition at line 516 of file winhelp.c.

517{
518 WINE_TRACE("Grab %p#%d++\n", win, win->ref_count);
519 win->ref_count++;
520 return win;
521}

Referenced by WINHELP_CreateHelpWindow().

◆ WINHELP_HandleCommand()

static LRESULT WINHELP_HandleCommand ( HWND  hSrcWnd,
LPARAM  lParam 
)
static

Definition at line 356 of file winhelp.c.

357{
359 WINHELP* wh;
360
361 if (cds->dwData != 0xA1DE505)
362 {
363 WINE_FIXME("Wrong magic number (%08lx)\n", cds->dwData);
364 return 0;
365 }
366
367 wh = cds->lpData;
368
369 if (wh)
370 {
371 char* ptr = (wh->ofsFilename) ? (LPSTR)wh + wh->ofsFilename : NULL;
372
373 WINE_TRACE("Got[%u]: cmd=%u data=%08x fn=%s\n",
374 wh->size, wh->command, wh->data, debugstr_a(ptr));
375 switch (wh->command)
376 {
377 case HELP_CONTEXT:
378 if (ptr)
379 {
380 MACRO_JumpContext(ptr, "main", wh->data);
381 }
383 break;
384 case HELP_QUIT:
385 MACRO_Exit();
386 break;
387 case HELP_CONTENTS:
388 if (ptr)
389 {
390 MACRO_JumpContents(ptr, "main");
391 }
393 break;
394 case HELP_HELPONHELP:
395 MACRO_HelpOn();
397 break;
398 /* case HELP_SETINDEX: */
399 case HELP_SETCONTENTS:
400 if (ptr)
401 {
403 }
404 break;
406 if (ptr)
407 {
409 }
410 break;
411 /* case HELP_FORCEFILE:*/
412 /* case HELP_CONTEXTMENU: */
413 case HELP_FINDER:
414 /* in fact, should be the topic dialog box */
415 WINE_FIXME("HELP_FINDER: stub\n");
416 if (ptr)
417 {
418 MACRO_JumpHash(ptr, "main", 0);
419 }
420 break;
421 /* case HELP_WM_HELP: */
422 /* case HELP_SETPOPUP_POS: */
423 /* case HELP_KEY: */
424 /* case HELP_COMMAND: */
425 /* case HELP_PARTIALKEY: */
426 /* case HELP_MULTIKEY: */
427 /* case HELP_SETWINPOS: */
428 default:
429 WINE_FIXME("Unhandled command (%x) for remote winhelp control\n", wh->command);
430 break;
431 }
432 }
433 /* Always return success for now */
434 return 1;
435}
static BOOL WINHELP_HasWorkingWindow(void)
Definition: winhelp.c:344
void CALLBACK MACRO_SetContents(LPCSTR str, LONG u)
Definition: macro.c:833
void CALLBACK MACRO_JumpContents(LPCSTR lpszPath, LPCSTR lpszWindow)
Definition: macro.c:140
void CALLBACK MACRO_PopupContext(LPCSTR str, LONG u)
Definition: macro.c:680
void CALLBACK MACRO_JumpContext(LPCSTR lpszPath, LPCSTR lpszWindow, LONG context)
Definition: macro.c:573
void CALLBACK MACRO_JumpHash(LPCSTR lpszPath, LPCSTR lpszWindow, LONG lHash)
Definition: macro.c:585
void CALLBACK MACRO_HelpOn(void)
Definition: macro.c:474
static PVOID ptr
Definition: dispmode.c:27
WORD size
Definition: winhelp.c:336
WORD command
Definition: winhelp.c:337
WORD ofsFilename
Definition: winhelp.c:340
LONG data
Definition: winhelp.c:338
ULONG_PTR dwData
Definition: winuser.h:3004
#define HELP_CONTEXTPOPUP
Definition: winuser.h:2410
#define HELP_QUIT
Definition: winuser.h:2417
#define HELP_SETCONTENTS
Definition: winuser.h:2418
#define HELP_HELPONHELP
Definition: winuser.h:2412
#define HELP_CONTENTS
Definition: winuser.h:2408
#define HELP_CONTEXT
Definition: winuser.h:2409
#define HELP_FINDER
Definition: winuser.h:2422

Referenced by WINHELP_MainWndProc().

◆ WINHELP_HandleTextMouse()

static BOOL WINHELP_HandleTextMouse ( WINHELP_WINDOW win,
UINT  msg,
LPARAM  lParam 
)
static

Definition at line 898 of file winhelp.c.

899{
900 HLPFILE* hlpfile;
902 BOOL ret = FALSE;
903
904 switch (msg)
905 {
906 case WM_LBUTTONDOWN:
908 {
910
911 switch (link->cookie)
912 {
913 case hlp_link_link:
914 if ((hlpfile = WINHELP_LookupHelpFile(link->string)))
915 {
916 if (link->window == -1)
917 {
918 wi = win->info;
919 if (wi->win_style & WS_POPUP) wi = Globals.active_win->info;
920 }
921 else if (link->window < hlpfile->numWindows)
922 wi = &hlpfile->windows[link->window];
923 else
924 {
925 WINE_WARN("link to window %d/%d\n", link->window, hlpfile->numWindows);
926 break;
927 }
929 }
930 break;
931 case hlp_link_popup:
932 if ((hlpfile = WINHELP_LookupHelpFile(link->string)))
935 SW_NORMAL);
936 break;
937 case hlp_link_macro:
938 MACRO_ExecuteMacro(win, link->string);
939 break;
940 default:
941 WINE_FIXME("Unknown link cookie %d\n", link->cookie);
942 }
943 ret = TRUE;
944 }
945 break;
946 }
947 return ret;
948}
HLPFILE * WINHELP_LookupHelpFile(LPCSTR lpszFile)
Definition: winhelp.c:211
static HLPFILE_LINK * WINHELP_FindLink(WINHELP_WINDOW *win, LPARAM pos)
Definition: winhelp.c:633
static HLPFILE_WINDOWINFO * WINHELP_GetPopupWindowInfo(HLPFILE *hlpfile, WINHELP_WINDOW *parent, LPARAM mouse)
Definition: winhelp.c:302
HLPFILE_PAGE * HLPFILE_PageByHash(HLPFILE *hlpfile, LONG lHash, ULONG *relative)
Definition: hlpfile.c:437
#define WINE_WARN
Definition: debug.h:360
int ret

Referenced by WINHELP_CheckPopup(), and WINHELP_MainWndProc().

◆ WINHELP_HasWorkingWindow()

static BOOL WINHELP_HasWorkingWindow ( void  )
static

Definition at line 344 of file winhelp.c.

345{
346 if (!Globals.active_win) return FALSE;
349}

Referenced by WINHELP_HandleCommand().

◆ WINHELP_HistoryWndProc()

static LRESULT CALLBACK WINHELP_HistoryWndProc ( HWND  hWnd,
UINT  msg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 1120 of file winhelp.c.

1121{
1123 PAINTSTRUCT ps;
1124 HDC hDc;
1126 unsigned int i;
1127 RECT r;
1128
1129 switch (msg)
1130 {
1131 case WM_NCCREATE:
1132 win = (WINHELP_WINDOW*)((LPCREATESTRUCTA)lParam)->lpCreateParams;
1134 win->hHistoryWnd = hWnd;
1135 break;
1136 case WM_CREATE:
1137 hDc = GetDC(hWnd);
1138 GetTextMetricsW(hDc, &tm);
1139 GetWindowRect(hWnd, &r);
1140
1141 r.right = r.left + 30 * tm.tmAveCharWidth;
1142 r.bottom = r.top + ARRAY_SIZE(Globals.history.set) * tm.tmHeight;
1144 if (r.left < 0) {r.right -= r.left; r.left = 0;}
1145 if (r.top < 0) {r.bottom -= r.top; r.top = 0;}
1146
1147 MoveWindow(hWnd, r.left, r.top, r.right, r.bottom, TRUE);
1148 ReleaseDC(hWnd, hDc);
1149 break;
1150 case WM_LBUTTONDOWN:
1151 hDc = GetDC(hWnd);
1152 GetTextMetricsW(hDc, &tm);
1153 i = HIWORD(lParam) / tm.tmHeight;
1154 if (i < Globals.history.index)
1156 ReleaseDC(hWnd, hDc);
1157 break;
1158 case WM_PAINT:
1159 hDc = BeginPaint(hWnd, &ps);
1160 GetTextMetricsW(hDc, &tm);
1161
1162 for (i = 0; i < Globals.history.index; i++)
1163 {
1165 {
1166 TextOutA(hDc, 0, i * tm.tmHeight,
1169 }
1170 else
1171 {
1172 char buffer[1024];
1173 const char* ptr1;
1174 const char* ptr2;
1175 unsigned len;
1176
1177 ptr1 = strrchr(Globals.history.set[i].page->file->lpszPath, '\\');
1178 if (!ptr1) ptr1 = Globals.history.set[i].page->file->lpszPath;
1179 else ptr1++;
1180 ptr2 = strrchr(ptr1, '.');
1181 len = ptr2 ? ptr2 - ptr1 : strlen(ptr1);
1182 if (len > sizeof(buffer)) len = sizeof(buffer);
1183 memcpy(buffer, ptr1, len);
1184 if (len < sizeof(buffer)) buffer[len++] = ':';
1186 TextOutA(hDc, 0, i * tm.tmHeight, buffer, strlen(buffer));
1187 }
1188 }
1189 EndPaint(hWnd, &ps);
1190 break;
1191 case WM_DESTROY:
1193 if (hWnd == win->hHistoryWnd)
1194 win->hHistoryWnd = 0;
1195 break;
1196 }
1197 return DefWindowProcA(hWnd, msg, wParam, lParam);
1198}
#define ARRAY_SIZE(A)
Definition: main.h:20
BOOL WINHELP_CreateHelpWindow(WINHELP_WNDPAGE *wpage, int nCmdShow, BOOL remember)
Definition: winhelp.c:701
#define lstrcpynA
Definition: compat.h:751
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
_CRT_RESTORE_GCC_WARNINGS _CRT_DISABLE_GCC_WARNINGS _Check_return_ _CRTIMP _CONST_RETURN char *__cdecl strrchr(_In_z_ const char *_Str, _In_ int _Ch)
WINHELP_PAGESET history
Definition: winhelp.h:140
LPSTR lpszTitle
Definition: hlpfile.h:70
WINHELP_WNDPAGE set[40]
Definition: winhelp.h:70
unsigned index
Definition: winhelp.h:71
Definition: time.h:68
uint32_t ULONG_PTR
Definition: typedefs.h:65
BOOL WINAPI GetTextMetricsW(_In_ HDC, _Out_ LPTEXTMETRICW)
Definition: text.c:221
BOOL WINAPI TextOutA(_In_ HDC hdc, _In_ int x, _In_ int y, _In_reads_(c) LPCSTR lpString, _In_ int c)
#define WM_PAINT
Definition: winuser.h:1623
BOOL WINAPI AdjustWindowRect(_Inout_ LPRECT, _In_ DWORD, _In_ BOOL)
#define WM_CREATE
Definition: winuser.h:1611
LONG WINAPI GetWindowLongW(_In_ HWND, _In_ int)
#define WM_NCCREATE
Definition: winuser.h:1686
BOOL WINAPI EndPaint(_In_ HWND, _In_ const PAINTSTRUCT *)
#define WM_DESTROY
Definition: winuser.h:1612
HDC WINAPI BeginPaint(_In_ HWND, _Out_ LPPAINTSTRUCT)
#define SetWindowLongPtrW
Definition: winuser.h:5358
#define GWL_STYLE
Definition: winuser.h:855
BOOL WINAPI MoveWindow(_In_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ BOOL)

Referenced by WINHELP_RegisterWinClasses().

◆ WINHELP_IndexDlgProc()

static INT_PTR CALLBACK WINHELP_IndexDlgProc ( HWND  hWnd,
UINT  msg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 1229 of file winhelp.c.

1230{
1231 static struct index_data* id;
1232 int sel;
1233
1234 switch (msg)
1235 {
1236 case WM_INITDIALOG:
1237 id = (struct index_data*)((PROPSHEETPAGEA*)lParam)->lParam;
1238 HLPFILE_BPTreeEnum(id->hlpfile->kwbtree, cb_KWBTree,
1240 id->jump = FALSE;
1241 id->offset = 1;
1242 return TRUE;
1243 case WM_COMMAND:
1244 switch (HIWORD(wParam))
1245 {
1246 case LBN_DBLCLK:
1247 if (LOWORD(wParam) == IDC_INDEXLIST)
1249 break;
1250 }
1251 break;
1252 case WM_NOTIFY:
1253 switch (((NMHDR*)lParam)->code)
1254 {
1255 case PSN_APPLY:
1257 if (sel != LB_ERR)
1258 {
1259 BYTE *p;
1260 int count;
1261
1263 count = *(short*)((char *)p + strlen((char *)p) + 1);
1264 if (count > 1)
1265 {
1266 MessageBoxA(hWnd, "count > 1 not supported yet", "Error", MB_OK | MB_ICONSTOP);
1268 return TRUE;
1269 }
1270 id->offset = *(ULONG*)((char *)p + strlen((char *)p) + 3);
1271 id->offset = *(long*)(id->hlpfile->kwdata + id->offset + 9);
1272 if (id->offset == 0xFFFFFFFF)
1273 {
1274 MessageBoxA(hWnd, "macro keywords not supported yet", "Error", MB_OK | MB_ICONSTOP);
1276 return TRUE;
1277 }
1278 id->jump = TRUE;
1280 }
1281 return TRUE;
1282 default:
1283 return FALSE;
1284 }
1285 break;
1286 default:
1287 break;
1288 }
1289 return FALSE;
1290}
static void cb_KWBTree(void *p, void **next, void *cookie)
Definition: winhelp.c:1206
void HLPFILE_BPTreeEnum(BYTE *buf, HLPFILE_BPTreeCallback cb, void *cookie)
Definition: hlpfile.c:125
#define PSNRET_INVALID
Definition: prsht.h:130
#define PSN_APPLY
Definition: prsht.h:117
#define PSNRET_NOERROR
Definition: prsht.h:129
#define PSBTN_OK
Definition: prsht.h:149
#define PSM_PRESSBUTTON
Definition: prsht.h:100
Definition: inflate.c:139
uint32_t ULONG
Definition: typedefs.h:59
#define IDC_INDEXLIST
Definition: winhelp_res.h:53
#define LB_ERR
Definition: winuser.h:2435
#define LB_GETITEMDATA
Definition: winuser.h:2044
#define LBN_DBLCLK
Definition: winuser.h:2074
int WINAPI MessageBoxA(_In_opt_ HWND hWnd, _In_opt_ LPCSTR lpText, _In_opt_ LPCSTR lpCaption, _In_ UINT uType)
#define WM_INITDIALOG
Definition: winuser.h:1742
LRESULT WINAPI SendDlgItemMessageW(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define MB_OK
Definition: winuser.h:793
#define DWLP_MSGRESULT
Definition: winuser.h:873
#define MB_ICONSTOP
Definition: winuser.h:806
#define LB_GETCURSEL
Definition: winuser.h:2042
unsigned char BYTE
Definition: xxhash.c:193

Referenced by WINHELP_CreateIndexWindow().

◆ WINHELP_InitFonts()

static void WINHELP_InitFonts ( HWND  hWnd)
static

Definition at line 58 of file winhelp.c.

59{
61 LOGFONTW logfontlist[] = {
62 {-10, 0, 0, 0, 400, 0, 0, 0, DEFAULT_CHARSET, 0, 0, 0, 32, {'H','e','l','v',0}},
63 {-12, 0, 0, 0, 700, 0, 0, 0, DEFAULT_CHARSET, 0, 0, 0, 32, {'H','e','l','v',0}},
64 {-12, 0, 0, 0, 700, 0, 0, 0, DEFAULT_CHARSET, 0, 0, 0, 32, {'H','e','l','v',0}},
65 {-12, 0, 0, 0, 400, 0, 0, 0, DEFAULT_CHARSET, 0, 0, 0, 32, {'H','e','l','v',0}},
66 {-12, 0, 0, 0, 700, 0, 0, 0, DEFAULT_CHARSET, 0, 0, 0, 32, {'H','e','l','v',0}},
67 {-10, 0, 0, 0, 700, 0, 0, 0, DEFAULT_CHARSET, 0, 0, 0, 32, {'H','e','l','v',0}},
68 { -8, 0, 0, 0, 400, 0, 0, 0, DEFAULT_CHARSET, 0, 0, 0, 32, {'H','e','l','v',0}}};
69
70 static HFONT fonts[ARRAY_SIZE(logfontlist)];
71 static BOOL init = FALSE;
72
73 win->fonts_len = ARRAY_SIZE(logfontlist);
74 win->fonts = fonts;
75
76 if (!init)
77 {
78 UINT i;
79
80 for (i = 0; i < ARRAY_SIZE(logfontlist); i++)
81 {
82 fonts[i] = CreateFontIndirectW(&logfontlist[i]);
83 }
84
85 init = TRUE;
86 }
87}
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
unsigned int UINT
Definition: ndis.h:50
#define DEFAULT_CHARSET
Definition: wingdi.h:384
static int init
Definition: wintirpc.c:33

Referenced by WINHELP_CreateHelpWindow().

◆ WINHELP_LayoutMainWindow()

void WINHELP_LayoutMainWindow ( WINHELP_WINDOW win)

Definition at line 437 of file winhelp.c.

438{
439 RECT rect, button_box_rect;
440 INT text_top = 0;
441 HWND hButtonBoxWnd = GetDlgItem(win->hMainWnd, CTL_ID_BUTTON);
442 HWND hTextWnd = GetDlgItem(win->hMainWnd, CTL_ID_TEXT);
443
444 GetClientRect(win->hMainWnd, &rect);
445
446 /* Update button box and text Window */
447 SetWindowPos(hButtonBoxWnd, HWND_TOP,
448 rect.left, rect.top,
449 rect.right - rect.left,
450 rect.bottom - rect.top, 0);
451
452 if (GetWindowRect(hButtonBoxWnd, &button_box_rect))
453 text_top = rect.top + button_box_rect.bottom - button_box_rect.top;
454
455 SetWindowPos(hTextWnd, HWND_TOP,
456 rect.left, text_top,
457 rect.right - rect.left,
458 rect.bottom - text_top, 0);
459
460}
& rect
Definition: startmenu.cpp:1413
LONG bottom
Definition: windef.h:309
LONG top
Definition: windef.h:307
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)

Referenced by MACRO_ChangeButtonBinding(), MACRO_CreateButton(), WINHELP_CreateHelpWindow(), and WINHELP_MainWndProc().

◆ WINHELP_LookupHelpFile()

HLPFILE * WINHELP_LookupHelpFile ( LPCSTR  lpszFile)

Definition at line 211 of file winhelp.c.

212{
213 HLPFILE* hlpfile;
214 char szFullName[MAX_PATH];
215 char szAddPath[MAX_PATH];
216 char *p;
217
218 /*
219 * NOTE: This is needed by popup windows only.
220 * In other cases it's not needed but does not hurt though.
221 */
223 {
224 strcpy(szAddPath, Globals.active_win->page->file->lpszPath);
225 p = strrchr(szAddPath, '\\');
226 if (p) *p = 0;
227 }
228
229 /*
230 * FIXME: Should we swap conditions?
231 */
232 if (!SearchPathA(NULL, lpszFile, ".hlp", MAX_PATH, szFullName, NULL) &&
233 !SearchPathA(szAddPath, lpszFile, ".hlp", MAX_PATH, szFullName, NULL))
234 {
237 return NULL;
238 if (!WINHELP_GetOpenFileName(szFullName, MAX_PATH))
239 return NULL;
240 }
241 hlpfile = HLPFILE_ReadHlpFile(szFullName);
242 if (!hlpfile)
245 return hlpfile;
246}
static INT WINHELP_MessageBoxIDS_s(UINT ids_text, LPCSTR str, UINT ids_title, WORD type)
Definition: winhelp.c:196
BOOL WINHELP_GetOpenFileName(LPSTR lpszFile, int len)
Definition: winhelp.c:145
DWORD WINAPI SearchPathA(IN LPCSTR lpPath OPTIONAL, IN LPCSTR lpFileName, IN LPCSTR lpExtension OPTIONAL, IN DWORD nBufferLength, OUT LPSTR lpBuffer, OUT LPSTR *lpFilePart OPTIONAL)
Definition: path.c:1123
HLPFILE * HLPFILE_ReadHlpFile(LPCSTR lpszPath)
Definition: hlpfile.c:2759
#define STID_HLPFILE_ERROR_s
Definition: winhelp_res.h:41
#define STID_WHERROR
Definition: winhelp_res.h:37
#define STID_FILE_NOT_FOUND_s
Definition: winhelp_res.h:48
#define MB_YESNO
Definition: winuser.h:820
#define MB_ICONQUESTION
Definition: winuser.h:792
#define IDYES
Definition: winuser.h:838

Referenced by MACRO_JumpContents(), MACRO_JumpContext(), MACRO_JumpHash(), WINHELP_HandleTextMouse(), and WinMain().

◆ WINHELP_MainWndProc()

static LRESULT CALLBACK WINHELP_MainWndProc ( HWND  hWnd,
UINT  msg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 1322 of file winhelp.c.

1323{
1326 HWND hTextWnd;
1327 LRESULT ret;
1328
1329 if (WINHELP_CheckPopup(hWnd, msg, wParam, lParam, &ret)) return ret;
1330
1331 switch (msg)
1332 {
1333 case WM_NCCREATE:
1334 win = (WINHELP_WINDOW*) ((LPCREATESTRUCTA) lParam)->lpCreateParams;
1336 if (!win->page && Globals.isBook)
1338 win->hMainWnd = hWnd;
1339 break;
1340
1343 break;
1344
1345 case WM_COMMAND:
1347 switch (LOWORD(wParam))
1348 {
1349 /* Menu FILE */
1350 case MNID_FILE_OPEN: MACRO_FileOpen(); break;
1351 case MNID_FILE_PRINT: MACRO_Print(); break;
1352 case MNID_FILE_SETUP: MACRO_PrinterSetup(); break;
1353 case MNID_FILE_EXIT: MACRO_Exit(); break;
1354
1355 /* Menu EDIT */
1356 case MNID_EDIT_COPYDLG:
1358 break;
1359 case MNID_EDIT_ANNOTATE:MACRO_Annotate(); break;
1360
1361 /* Menu Bookmark */
1363
1364 /* Menu Help */
1365 case MNID_HELP_HELPON: MACRO_HelpOn(); break;
1366 case MNID_HELP_HELPTOP: MACRO_HelpOnTop(); break;
1367 case MNID_HELP_ABOUT: MACRO_About(); break;
1368
1369 /* Context help */
1370 case MNID_CTXT_ANNOTATE:MACRO_Annotate(); break;
1371 case MNID_CTXT_COPY: MACRO_CopyDialog(); break;
1372 case MNID_CTXT_PRINT: MACRO_Print(); break;
1373 case MNID_OPTS_HISTORY: MACRO_History(); break;
1377 if (win->font_scale != 0)
1378 {
1379 win->font_scale = 0;
1380 WINHELP_SetupText(GetDlgItem(hWnd, CTL_ID_TEXT), win, 0 /* FIXME */);
1381 }
1382 break;
1386 if (win->font_scale != 1)
1387 {
1388 win->font_scale = 1;
1389 WINHELP_SetupText(GetDlgItem(hWnd, CTL_ID_TEXT), win, 0 /* FIXME */);
1390 }
1391 break;
1395 if (win->font_scale != 2)
1396 {
1397 win->font_scale = 2;
1398 WINHELP_SetupText(GetDlgItem(hWnd, CTL_ID_TEXT), win, 0 /* FIXME */);
1399 }
1400 break;
1401
1402 default:
1403 /* Buttons */
1404 for (button = win->first_button; button; button = button->next)
1405 if (wParam == button->wParam) break;
1406 if (button)
1407 MACRO_ExecuteMacro(win, button->lpszMacro);
1408 else if (!HIWORD(wParam))
1411 break;
1412 }
1413 break;
1414/* EPP case WM_DESTROY: */
1415/* EPP if (Globals.hPopupWnd) DestroyWindow(Globals.hPopupWnd); */
1416/* EPP break; */
1417 case WM_COPYDATA:
1419
1420 case WM_CHAR:
1421 if (wParam == 3)
1422 {
1424 return 0;
1425 }
1426 break;
1427
1428 case WM_KEYDOWN:
1430 hTextWnd = GetDlgItem(win->hMainWnd, CTL_ID_TEXT);
1431
1432 switch (wParam)
1433 {
1434 case VK_UP:
1435 SendMessageW(hTextWnd, EM_SCROLL, SB_LINEUP, 0);
1436 return 0;
1437 case VK_DOWN:
1438 SendMessageW(hTextWnd, EM_SCROLL, SB_LINEDOWN, 0);
1439 return 0;
1440 case VK_PRIOR:
1441 SendMessageW(hTextWnd, EM_SCROLL, SB_PAGEUP, 0);
1442 return 0;
1443 case VK_NEXT:
1444 SendMessageW(hTextWnd, EM_SCROLL, SB_PAGEDOWN, 0);
1445 return 0;
1446 case VK_ESCAPE:
1447 MACRO_Exit();
1448 return 0;
1449 }
1450 break;
1451
1452 case WM_NOTIFY:
1453 if (wParam == CTL_ID_TEXT)
1454 {
1455 RECT rc;
1456
1457 switch (((NMHDR*)lParam)->code)
1458 {
1459 case EN_MSGFILTER:
1460 {
1461 const MSGFILTER* msgf = (const MSGFILTER*)lParam;
1462 switch (msgf->msg)
1463 {
1464 case WM_KEYUP:
1465 if (msgf->wParam == VK_ESCAPE)
1467 break;
1468 case WM_RBUTTONDOWN:
1469 {
1470 HMENU hMenu;
1471 POINT pt;
1472
1475 switch (win->font_scale)
1476 {
1477 case 0:
1480 break;
1481 default:
1482 WINE_FIXME("Unsupported %d\n", win->font_scale);
1483 /* fall through */
1484 case 1:
1487 break;
1488 case 2:
1491 break;
1492 }
1493 pt.x = (int)(short)LOWORD(msgf->lParam);
1494 pt.y = (int)(short)HIWORD(msgf->lParam);
1497 pt.x, pt.y, 0, hWnd, NULL);
1498 DestroyMenu(hMenu);
1499 }
1500 break;
1501 default:
1503 msgf->msg, msgf->lParam);
1504 }
1505 }
1506 break;
1507
1508 case EN_REQUESTRESIZE:
1509 rc = ((REQRESIZE*)lParam)->rc;
1512 FALSE);
1513 SetWindowPos(win->hMainWnd, HWND_TOP, 0, 0,
1514 rc.right - rc.left, rc.bottom - rc.top,
1517 break;
1518 }
1519 }
1520 break;
1521
1522 case WM_INITMENUPOPUP:
1525 (win->font_scale == 0) ? MF_CHECKED : MF_UNCHECKED);
1527 (win->font_scale == 1) ? MF_CHECKED : MF_UNCHECKED);
1529 (win->font_scale == 2) ? MF_CHECKED : MF_UNCHECKED);
1530 break;
1531 case WM_DESTROY:
1534 break;
1535 }
1536 return DefWindowProcA(hWnd, msg, wParam, lParam);
1537}
static LRESULT WINHELP_HandleCommand(HWND hSrcWnd, LPARAM lParam)
Definition: winhelp.c:356
static void WINHELP_DeleteWindow(WINHELP_WINDOW *win)
Definition: winhelp.c:543
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31
void CALLBACK MACRO_Print(void)
Definition: macro.c:715
void CALLBACK MACRO_BookmarkDefine(void)
Definition: macro.c:200
void CALLBACK MACRO_CopyDialog(void)
Definition: macro.c:336
void CALLBACK MACRO_PrinterSetup(void)
Definition: macro.c:746
void CALLBACK MACRO_FileOpen(void)
Definition: macro.c:421
void CALLBACK MACRO_HelpOnTop(void)
Definition: macro.c:489
void CALLBACK MACRO_About(void)
Definition: macro.c:152
void CALLBACK MACRO_History(void)
Definition: macro.c:516
void CALLBACK MACRO_Annotate(void)
Definition: macro.c:171
#define EN_REQUESTRESIZE
Definition: richedit.h:192
HWND hwndFrom
Definition: winuser.h:3160
LONG_PTR LRESULT
Definition: windef.h:209
#define MNID_HELP_ABOUT
Definition: winhelp_res.h:23
#define MNID_OPTS_FONTS_NORMAL
Definition: winhelp_res.h:18
#define MNID_BKMK_DEFINE
Definition: winhelp_res.h:14
#define MNID_CTXT_FONTS_SMALL
Definition: winhelp_res.h:28
#define MNID_OPTS_FONTS_SMALL
Definition: winhelp_res.h:17
#define MNID_OPTS_FONTS_LARGE
Definition: winhelp_res.h:19
#define MNID_FILE_EXIT
Definition: winhelp_res.h:9
#define CONTEXT_MENU
Definition: winhelp_res.h:33
#define MNID_HELP_HELPTOP
Definition: winhelp_res.h:22
#define MNID_HELP_HELPON
Definition: winhelp_res.h:21
#define MNID_FILE_PRINT
Definition: winhelp_res.h:7
#define MNID_CTXT_ANNOTATE
Definition: winhelp_res.h:25
#define MNID_FILE_SETUP
Definition: winhelp_res.h:8
#define MNID_EDIT_COPYDLG
Definition: winhelp_res.h:11
#define MNID_CTXT_FONTS_LARGE
Definition: winhelp_res.h:30
#define MNID_EDIT_ANNOTATE
Definition: winhelp_res.h:12
#define MNID_OPTS_HISTORY
Definition: winhelp_res.h:16
#define MNID_FILE_OPEN
Definition: winhelp_res.h:6
#define STID_NOT_IMPLEMENTED
Definition: winhelp_res.h:40
#define MNID_CTXT_COPY
Definition: winhelp_res.h:26
#define MNID_CTXT_FONTS_NORMAL
Definition: winhelp_res.h:29
#define MNID_CTXT_PRINT
Definition: winhelp_res.h:27
#define MF_BYCOMMAND
Definition: winuser.h:202
#define SB_LINEUP
Definition: winuser.h:564
#define WM_KEYUP
Definition: winuser.h:1719
BOOL WINAPI PostMessageW(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define MF_CHECKED
Definition: winuser.h:132
int WINAPI MessageBoxW(_In_opt_ HWND hWnd, _In_opt_ LPCWSTR lpText, _In_opt_ LPCWSTR lpCaption, _In_ UINT uType)
#define MF_UNCHECKED
Definition: winuser.h:204
#define TPM_TOPALIGN
Definition: winuser.h:2386
DWORD WINAPI CheckMenuItem(_In_ HMENU, _In_ UINT, _In_ UINT)
HMENU WINAPI GetSubMenu(_In_ HMENU, _In_ int)
#define WM_INITMENUPOPUP
Definition: winuser.h:1749
#define TPM_LEFTALIGN
Definition: winuser.h:2380
#define EM_SCROLL
Definition: winuser.h:2010
#define SB_PAGEDOWN
Definition: winuser.h:569
#define WM_COPYDATA
Definition: winuser.h:1667
#define SB_LINEDOWN
Definition: winuser.h:565
#define WM_CHAR
Definition: winuser.h:1720
BOOL WINAPI DestroyMenu(_In_ HMENU)
#define WM_COPY
Definition: winuser.h:1865
BOOL WINAPI TrackPopupMenu(_In_ HMENU, _In_ UINT, _In_ int, _In_ int, _Reserved_ int, _In_ HWND, _Reserved_ LPCRECT)
#define SWP_NOZORDER
Definition: winuser.h:1250
#define WM_WINDOWPOSCHANGED
Definition: winuser.h:1665
#define SB_PAGEUP
Definition: winuser.h:568

Referenced by WINHELP_RegisterWinClasses().

◆ WINHELP_MessageBoxIDS_s()

static INT WINHELP_MessageBoxIDS_s ( UINT  ids_text,
LPCSTR  str,
UINT  ids_title,
WORD  type 
)
static

Definition at line 196 of file winhelp.c.

197{
199 CHAR newtext[MAX_STRING_LEN + MAX_PATH];
200
201 LoadStringA(Globals.hInstance, ids_text, text, sizeof(text));
202 wsprintfA(newtext, text, str);
203
204 return MessageBoxA(0, newtext, MAKEINTRESOURCEA(ids_title), type);
205}
const WCHAR * text
Definition: package.c:1794
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
const WCHAR * str
int WINAPIV wsprintfA(_Out_ LPSTR, _In_ _Printf_format_string_ LPCSTR,...)

Referenced by WINHELP_LookupHelpFile().

◆ WINHELP_OpenHelpWindow()

BOOL WINHELP_OpenHelpWindow ( HLPFILE_PAGE *(*)(HLPFILE *, LONG, ULONG *)  lookup,
HLPFILE hlpfile,
LONG  val,
HLPFILE_WINDOWINFO wi,
int  nCmdShow 
)

Definition at line 882 of file winhelp.c.

885{
886 WINHELP_WNDPAGE wpage;
887
888 wpage.page = lookup(hlpfile, val, &wpage.relative);
889 if (wpage.page) wpage.page->file->wRefCount++;
890 wpage.wininfo = wi;
891 return WINHELP_CreateHelpWindow(&wpage, nCmdShow, TRUE);
892}
static ULONG lookup[16]
Definition: vga.c:48
GLuint GLfloat * val
Definition: glext.h:7180

Referenced by MACRO_JumpContents(), MACRO_JumpContext(), MACRO_JumpHash(), WINHELP_CreateIndexWindow(), WINHELP_HandleTextMouse(), and WinMain().

◆ WINHELP_RegisterWinClasses()

static BOOL WINHELP_RegisterWinClasses ( void  )
static

Definition at line 1609 of file winhelp.c.

1610{
1611 WNDCLASSEXA class_main, class_button_box, class_history;
1612
1613 class_main.cbSize = sizeof(class_main);
1614 class_main.style = CS_HREDRAW | CS_VREDRAW;
1615 class_main.lpfnWndProc = WINHELP_MainWndProc;
1616 class_main.cbClsExtra = 0;
1617 class_main.cbWndExtra = sizeof(WINHELP_WINDOW *);
1618 class_main.hInstance = Globals.hInstance;
1620 class_main.hCursor = LoadCursorW(0, (LPWSTR)IDC_ARROW);
1621 class_main.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
1622 class_main.lpszMenuName = 0;
1626 LR_SHARED);
1627
1628 class_button_box = class_main;
1629 class_button_box.lpfnWndProc = WINHELP_ButtonBoxWndProc;
1630 class_button_box.cbWndExtra = 0;
1631 class_button_box.hbrBackground = (HBRUSH)(COLOR_BTNFACE+1);
1632 class_button_box.lpszClassName = BUTTON_BOX_WIN_CLASS_NAME;
1633
1634 class_history = class_main;
1635 class_history.lpfnWndProc = WINHELP_HistoryWndProc;
1636 class_history.lpszClassName = HISTORY_WIN_CLASS_NAME;
1637
1638 return (RegisterClassExA(&class_main) &&
1639 RegisterClassExA(&class_button_box) &&
1640 RegisterClassExA(&class_history));
1641}
const char HISTORY_WIN_CLASS_NAME[]
Definition: string.c:25
static LRESULT CALLBACK WINHELP_MainWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
Definition: winhelp.c:1322
static LRESULT CALLBACK WINHELP_ButtonBoxWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
Definition: winhelp.c:1026
static LRESULT CALLBACK WINHELP_HistoryWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
Definition: winhelp.c:1120
int cbClsExtra
Definition: winuser.h:3207
HINSTANCE hInstance
Definition: winuser.h:3209
HCURSOR hCursor
Definition: winuser.h:3211
LPCSTR lpszMenuName
Definition: winuser.h:3213
HICON hIconSm
Definition: winuser.h:3215
UINT style
Definition: winuser.h:3205
int cbWndExtra
Definition: winuser.h:3208
UINT cbSize
Definition: winuser.h:3204
WNDPROC lpfnWndProc
Definition: winuser.h:3206
LPCSTR lpszClassName
Definition: winuser.h:3214
HICON hIcon
Definition: winuser.h:3210
HBRUSH hbrBackground
Definition: winuser.h:3212
#define CS_VREDRAW
Definition: winuser.h:658
#define COLOR_WINDOW
Definition: winuser.h:921
#define CS_HREDRAW
Definition: winuser.h:653
#define IDC_ARROW
Definition: winuser.h:687
ATOM WINAPI RegisterClassExA(_In_ CONST WNDCLASSEXA *)
HICON WINAPI LoadIconW(_In_opt_ HINSTANCE hInstance, _In_ LPCWSTR lpIconName)
Definition: cursoricon.c:2127
#define COLOR_BTNFACE
Definition: winuser.h:931

Referenced by WinMain().

◆ WINHELP_ReleaseWindow()

BOOL WINHELP_ReleaseWindow ( WINHELP_WINDOW win)

Definition at line 527 of file winhelp.c.

528{
529 WINE_TRACE("Release %p#%d--\n", win, win->ref_count);
530
531 if (!--win->ref_count)
532 {
533 DestroyWindow(win->hMainWnd);
534 return FALSE;
535 }
536 return TRUE;
537}

Referenced by MACRO_CloseSecondarys(), MACRO_CloseWindow(), MACRO_Exit(), WINHELP_CheckPopup(), WINHELP_CreateHelpWindow(), and WINHELP_MainWndProc().

◆ WINHELP_RememberPage()

static void WINHELP_RememberPage ( WINHELP_WINDOW win,
WINHELP_WNDPAGE wpage 
)
static

Definition at line 595 of file winhelp.c.

596{
597 unsigned num;
598
599 if (!Globals.history.index || Globals.history.set[0].page != wpage->page)
600 {
602 /* we're full, remove latest entry */
603 if (Globals.history.index == num)
604 {
607 }
609 Globals.history.index * sizeof(Globals.history.set[0]));
610 Globals.history.set[0] = *wpage;
612 wpage->page->file->wRefCount++;
613 }
614 if (win->hHistoryWnd) InvalidateRect(win->hHistoryWnd, NULL, TRUE);
615
616 num = ARRAY_SIZE(win->back.set);
617 if (win->back.index == num)
618 {
619 /* we're full, remove latest entry */
620 HLPFILE_FreeHlpFile(win->back.set[0].page->file);
621 memmove(&win->back.set[0], &win->back.set[1],
622 (num - 1) * sizeof(win->back.set[0]));
623 win->back.index--;
624 }
625 win->back.set[win->back.index++] = *wpage;
626 wpage->page->file->wRefCount++;
627}
GLuint GLuint num
Definition: glext.h:9618
#define memmove(s1, s2, n)
Definition: mkisofs.h:881

Referenced by WINHELP_CreateHelpWindow().

◆ WINHELP_RicheditWndProc()

static LRESULT CALLBACK WINHELP_RicheditWndProc ( HWND  hWnd,
UINT  msg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 673 of file winhelp.c.

675{
677 DWORD messagePos;
678 POINT pt;
679 switch(msg)
680 {
681 case WM_SETCURSOR:
682 messagePos = GetMessagePos();
683 pt.x = (short)LOWORD(messagePos);
684 pt.y = (short)HIWORD(messagePos);
686 if (win->page && WINHELP_FindLink(win, MAKELPARAM(pt.x, pt.y)))
687 {
688 SetCursor(win->hHandCur);
689 return 0;
690 }
691 /* fall through */
692 default:
693 return CallWindowProcA(win->origRicheditWndProc, hWnd, msg, wParam, lParam);
694 }
695}
#define MAKELPARAM(l, h)
Definition: winuser.h:4011
DWORD WINAPI GetMessagePos(void)
Definition: message.c:1351
HCURSOR WINAPI SetCursor(_In_opt_ HCURSOR)
#define WM_SETCURSOR
Definition: winuser.h:1639
BOOL WINAPI ScreenToClient(_In_ HWND, _Inout_ LPPOINT)

Referenced by WINHELP_CreateHelpWindow().

◆ WINHELP_RtfStreamIn()

static DWORD CALLBACK WINHELP_RtfStreamIn ( DWORD_PTR  cookie,
BYTE buff,
LONG  cb,
LONG pcb 
)
static

Definition at line 89 of file winhelp.c.

91{
92 struct RtfData* rd = (struct RtfData*)cookie;
93
94 if (rd->where >= rd->ptr) return 1;
95 if (rd->where + cb > rd->ptr)
96 cb = rd->ptr - rd->where;
97 memcpy(buff, rd->where, cb);
98 rd->where += cb;
99 *pcb = cb;
100 return 0;
101}
static unsigned char buff[32768]
Definition: fatten.c:17
static HMODULE MODULEINFO DWORD cb
Definition: module.c:33
int rd
Definition: scanf.h:134

Referenced by WINHELP_SetupText().

◆ WINHELP_SearchDlgProc()

static INT_PTR CALLBACK WINHELP_SearchDlgProc ( HWND  hWnd,
UINT  msg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 1296 of file winhelp.c.

1297{
1298 switch (msg)
1299 {
1300 case WM_INITDIALOG:
1301 return TRUE;
1302 case WM_NOTIFY:
1303 switch (((NMHDR*)lParam)->code)
1304 {
1305 case PSN_APPLY:
1307 return TRUE;
1308 default:
1309 return FALSE;
1310 }
1311 break;
1312 default:
1313 break;
1314 }
1315 return FALSE;
1316}

Referenced by WINHELP_CreateIndexWindow().

◆ WINHELP_SetupText()

static void WINHELP_SetupText ( HWND  hTextWnd,
WINHELP_WINDOW win,
ULONG  relative 
)
static

Definition at line 103 of file winhelp.c.

104{
105 static const WCHAR emptyW[1];
106 /* At first clear area - needed by EM_POSFROMCHAR/EM_SETSCROLLPOS */
107 SendMessageW(hTextWnd, WM_SETTEXT, 0, (LPARAM)emptyW);
108 SendMessageW(hTextWnd, WM_SETREDRAW, FALSE, 0);
109 SendMessageW(hTextWnd, EM_SETBKGNDCOLOR, 0, (LPARAM)win->info->sr_color);
110 /* set word-wrap to window size (undocumented) */
111 SendMessageW(hTextWnd, EM_SETTARGETDEVICE, 0, 0);
112 if (win->page)
113 {
114 struct RtfData rd;
116 unsigned cp = 0;
117 POINTL ptl;
118 POINT pt;
119
120
121 if (HLPFILE_BrowsePage(win->page, &rd, win->font_scale, relative))
122 {
123 rd.where = rd.data;
124 es.dwCookie = (DWORD_PTR)&rd;
125 es.dwError = 0;
126 es.pfnCallback = WINHELP_RtfStreamIn;
127
128 SendMessageW(hTextWnd, EM_STREAMIN, SF_RTF, (LPARAM)&es);
129 cp = rd.char_pos_rel;
130 }
131 /* FIXME: else leaking potentially the rd.first_link chain */
132 HeapFree(GetProcessHeap(), 0, rd.data);
133 SendMessageW(hTextWnd, EM_POSFROMCHAR, (WPARAM)&ptl, cp ? cp - 1 : 0);
134 pt.x = 0; pt.y = ptl.y;
135 SendMessageW(hTextWnd, EM_SETSCROLLPOS, 0, (LPARAM)&pt);
136 }
137 SendMessageW(hTextWnd, WM_SETREDRAW, TRUE, 0);
139}
static DWORD CALLBACK WINHELP_RtfStreamIn(DWORD_PTR cookie, BYTE *buff, LONG cb, LONG *pcb)
Definition: winhelp.c:89
BOOL HLPFILE_BrowsePage(HLPFILE_PAGE *page, struct RtfData *rd, unsigned font_scale, unsigned relative)
Definition: hlpfile.c:1703
#define es
Definition: i386-dis.c:440
static const WCHAR emptyW[]
Definition: navigate.c:40
#define EM_STREAMIN
Definition: richedit.h:106
#define EM_SETSCROLLPOS
Definition: richedit.h:166
#define SF_RTF
Definition: richedit.h:721
#define EM_SETBKGNDCOLOR
Definition: richedit.h:100
#define EM_SETTARGETDEVICE
Definition: richedit.h:105
unsigned relative
Definition: hlpfile.h:201
#define DWORD_PTR
Definition: treelist.c:76
BOOL WINAPI RedrawWindow(_In_opt_ HWND, _In_opt_ LPCRECT, _In_opt_ HRGN, _In_ UINT)
#define WM_SETTEXT
Definition: winuser.h:1620
#define RDW_FRAME
Definition: winuser.h:1215
#define RDW_INVALIDATE
Definition: winuser.h:1217
#define WM_SETREDRAW
Definition: winuser.h:1619
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by WINHELP_CreateHelpWindow(), and WINHELP_MainWndProc().

◆ WinMain()

int PASCAL WinMain ( HINSTANCE  hInstance,
HINSTANCE  prev,
LPSTR  cmdline,
int  show 
)

Definition at line 1647 of file winhelp.c.

1648{
1649 MSG msg;
1650 LONG lHash = 0;
1651 HLPFILE* hlpfile;
1652 static CHAR default_wndname[] = "main";
1653 LPSTR wndname = default_wndname;
1655 HACCEL hAccel;
1656
1658
1659 if (LoadLibraryA("riched20.dll") == NULL)
1662
1663 /* Get options */
1664 while (*cmdline && (*cmdline == ' ' || *cmdline == '-'))
1665 {
1666 CHAR option;
1667 LPCSTR topic_id;
1668 if (*cmdline++ == ' ') continue;
1669
1670 option = *cmdline;
1671 if (option) cmdline++;
1672 while (*cmdline == ' ') cmdline++;
1673 switch (option)
1674 {
1675 case 'i':
1676 case 'I':
1677 topic_id = cmdline;
1678 while (*cmdline && *cmdline != ' ') cmdline++;
1679 if (*cmdline) *cmdline++ = '\0';
1680 lHash = HLPFILE_Hash(topic_id);
1681 break;
1682
1683 case '3':
1684 case '4':
1685 Globals.wVersion = option - '0';
1686 break;
1687
1688 case 'x':
1689 show = SW_HIDE;
1691 break;
1692
1693 default:
1694 WINE_FIXME("Unsupported cmd line: %s\n", debugstr_a(cmdline));
1695 break;
1696 }
1697 }
1698
1699 /* Create primary window */
1701 {
1702 WINE_FIXME("Couldn't register classes\n");
1703 return 0;
1704 }
1705
1706 if (*cmdline)
1707 {
1708 char* ptr;
1709 if ((*cmdline == '"') && (ptr = strchr(cmdline+1, '"')))
1710 {
1711 cmdline++;
1712 *ptr = '\0';
1713 }
1714 if ((ptr = strchr(cmdline, '>')))
1715 {
1716 *ptr = '\0';
1717 wndname = ptr + 1;
1718 }
1720 if (!hlpfile) return 0;
1721 }
1722 else hlpfile = NULL;
1724 WINHELP_GetWindowInfo(hlpfile, wndname), show);
1725
1726 /* Message loop */
1728 while ((Globals.win_list || Globals.active_popup) && GetMessageW(&msg, 0, 0, 0))
1729 {
1732 {
1735 }
1736 }
1737 for (dll = Globals.dlls; dll; dll = dll->next)
1738 {
1739 if (dll->class & DC_INITTERM) dll->handler(DW_TERM, 0, 0);
1740 }
1741 return 0;
1742}
char * strchr(const char *String, int ch)
Definition: utclib.c:501
static BOOL WINHELP_RegisterWinClasses(void)
Definition: winhelp.c:1609
HLPFILE_WINDOWINFO * WINHELP_GetWindowInfo(HLPFILE *hlpfile, LPCSTR name)
Definition: winhelp.c:253
HINSTANCE hInstance
Definition: charmap.c:19
HINSTANCE WINAPI DECLSPEC_HOTPATCH LoadLibraryA(LPCSTR lpLibFileName)
Definition: loader.c:111
LONG HLPFILE_Hash(LPCSTR lpszContext)
Definition: hlpfile.c:547
HACCEL hAccel
Definition: main.c:47
static HMODULE dll
Definition: str.c:188
long LONG
Definition: pedump.c:60
TCHAR * cmdline
Definition: stretchblt.cpp:32
WINHELP_DLL * dlls
Definition: winhelp.h:139
Definition: getopt.h:109
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1829
#define DC_INITTERM
Definition: winhelp.h:102
#define DW_TERM
Definition: winhelp.h:112
#define MAIN_ACCEL
Definition: winhelp_res.h:34
#define STID_NO_RICHEDIT
Definition: winhelp_res.h:49
#define SW_HIDE
Definition: winuser.h:771
BOOL WINAPI TranslateMessage(_In_ const MSG *)
BOOL WINAPI GetMessageW(_Out_ LPMSG, _In_opt_ HWND, _In_ UINT, _In_ UINT)
HACCEL WINAPI LoadAcceleratorsW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
LRESULT WINAPI DispatchMessageW(_In_ const MSG *)
int WINAPI TranslateAcceleratorW(_In_ HWND, _In_ HACCEL, _In_ LPMSG)
const char * LPCSTR
Definition: xmlstorage.h:183

Variable Documentation

◆ Globals