ReactOS 0.4.15-dev-7089-gea8a49d
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 1202 of file winhelp.c.

1203{
1204 HWND hListWnd = cookie;
1205 int count;
1206
1207 WINE_TRACE("Adding %s to search list\n", debugstr_a((char *)p));
1208 SendMessageA(hListWnd, LB_INSERTSTRING, -1, (LPARAM)p);
1209 count = SendMessageW(hListWnd, LB_GETCOUNT, 0, 0);
1210 SendMessageW(hListWnd, LB_SETITEMDATA, count-1, (LPARAM)p);
1211 *next = (char*)p + strlen((char*)p) + 7;
1212}
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:2037
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define LB_INSERTSTRING
Definition: winuser.h:2052
#define LB_SETITEMDATA
Definition: winuser.h:2064
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 1022 of file winhelp.c.

1023{
1024 WINDOWPOS *winpos;
1027 SIZE button_size;
1028 INT x, y;
1029
1030 if (WINHELP_CheckPopup(hWnd, msg, wParam, lParam, NULL)) return 0L;
1031
1032 switch (msg)
1033 {
1035 winpos = (WINDOWPOS*) lParam;
1037
1038 /* Update buttons */
1039 button_size.cx = 0;
1040 button_size.cy = 0;
1041 for (button = win->first_button; button; button = button->next)
1042 {
1043 HDC hDc;
1044 SIZE textsize;
1045 if (!button->hWnd)
1046 {
1047 button->hWnd = CreateWindowA(STRING_BUTTON, button->lpszName,
1049 0, 0, 0, 0,
1050 hWnd, (HMENU) button->wParam,
1051 Globals.hInstance, 0);
1052 if (button->hWnd)
1053 {
1054 if (Globals.button_proc == NULL)
1055 {
1056 NONCLIENTMETRICSW ncm;
1058
1059 ncm.cbSize = sizeof(NONCLIENTMETRICSW);
1060 SystemParametersInfoW(SPI_GETNONCLIENTMETRICS,
1061 sizeof(NONCLIENTMETRICSW), &ncm, 0);
1062 Globals.hButtonFont = CreateFontIndirectW(&ncm.lfMenuFont);
1063 }
1065 if (Globals.hButtonFont)
1067 }
1068 }
1069 hDc = GetDC(button->hWnd);
1070 GetTextExtentPointA(hDc, button->lpszName, strlen(button->lpszName), &textsize);
1071 ReleaseDC(button->hWnd, hDc);
1072
1073 button_size.cx = max(button_size.cx, textsize.cx + BUTTON_CX);
1074 button_size.cy = max(button_size.cy, textsize.cy + BUTTON_CY);
1075 }
1076
1077 x = 0;
1078 y = 0;
1079 for (button = win->first_button; button; button = button->next)
1080 {
1081 SetWindowPos(button->hWnd, HWND_TOP, x, y, button_size.cx, button_size.cy, 0);
1082
1083 if (x + 2 * button_size.cx <= winpos->cx)
1084 x += button_size.cx;
1085 else
1086 x = 0, y += button_size.cy;
1087 }
1088 winpos->cy = y + (x ? button_size.cy : 0);
1089 break;
1090
1091 case WM_COMMAND:
1093 break;
1094
1095 case WM_KEYDOWN:
1096 switch (wParam)
1097 {
1098 case VK_UP:
1099 case VK_DOWN:
1100 case VK_PRIOR:
1101 case VK_NEXT:
1102 case VK_ESCAPE:
1104 }
1105 break;
1106 }
1107
1108 return DefWindowProcA(hWnd, msg, wParam, lParam);
1109}
#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:998
static BOOL WINHELP_CheckPopup(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, LRESULT *lret)
Definition: winhelp.c:950
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:92
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:5344
#define GetWindowLongPtrW
Definition: winuser.h:4828
LRESULT WINAPI DefWindowProcA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define WM_WINDOWPOSCHANGING
Definition: winuser.h:1660
#define CreateWindowA(a, b, c, d, e, f, g, h, i, j, k)
Definition: winuser.h:4314
BOOL WINAPI SetWindowPos(_In_ HWND, _In_opt_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ UINT)
#define WM_COMMAND
Definition: winuser.h:1739
#define VK_UP
Definition: winuser.h:2224
#define GetWindowLongPtrA
Definition: winuser.h:4827
#define VK_NEXT
Definition: winuser.h:2220
#define HWND_TOP
Definition: winuser.h:1206
#define WM_SETFONT
Definition: winuser.h:1649
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:2226
#define VK_PRIOR
Definition: winuser.h:2219
#define WM_KEYDOWN
Definition: winuser.h:1714
LRESULT(CALLBACK * WNDPROC)(HWND, UINT, WPARAM, LPARAM)
Definition: winuser.h:2905
#define VK_ESCAPE
Definition: winuser.h:2213

Referenced by WINHELP_RegisterWinClasses().

◆ WINHELP_ButtonWndProc()

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

Definition at line 998 of file winhelp.c.

999{
1000 if (WINHELP_CheckPopup(hWnd, msg, wParam, lParam, NULL)) return 0;
1001
1002 if (msg == WM_KEYDOWN)
1003 {
1004 switch (wParam)
1005 {
1006 case VK_UP:
1007 case VK_DOWN:
1008 case VK_PRIOR:
1009 case VK_NEXT:
1010 case VK_ESCAPE:
1012 }
1013 }
1014
1016}
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 950 of file winhelp.c.

951{
952 WINHELP_WINDOW* popup;
953
954 if (!Globals.active_popup) return FALSE;
955
956 switch (msg)
957 {
958 case WM_NOTIFY:
959 {
960 MSGFILTER* msgf = (MSGFILTER*)lParam;
961 if (msgf->nmhdr.code == EN_MSGFILTER)
962 {
963 if (!WINHELP_CheckPopup(hWnd, msgf->msg, msgf->wParam, msgf->lParam, NULL))
964 return FALSE;
965 if (lret) *lret = 1;
966 return TRUE;
967 }
968 }
969 break;
970 case WM_ACTIVATE:
974 break;
975 /* fall through */
976 case WM_LBUTTONDOWN:
977 if (msg == WM_LBUTTONDOWN)
979 /* fall through */
980 case WM_MBUTTONDOWN:
981 case WM_RBUTTONDOWN:
982 case WM_NCLBUTTONDOWN:
983 case WM_NCMBUTTONDOWN:
984 case WM_NCRBUTTONDOWN:
985 popup = Globals.active_popup;
988 if (lret) *lret = 1;
989 return TRUE;
990 }
991 return FALSE;
992}
static BOOL WINHELP_HandleTextMouse(WINHELP_WINDOW *win, UINT msg, LPARAM lParam)
Definition: winhelp.c:894
BOOL WINHELP_ReleaseWindow(WINHELP_WINDOW *win)
Definition: winhelp.c:523
#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:3158
HWND hMainWnd
Definition: winhelp.h:80
#define GW_OWNER
Definition: winuser.h:766
#define WA_INACTIVE
Definition: winuser.h:2621
#define WM_LBUTTONDOWN
Definition: winuser.h:1775
#define WM_ACTIVATE
Definition: winuser.h:1611
#define WM_RBUTTONDOWN
Definition: winuser.h:1778
#define WM_NCMBUTTONDOWN
Definition: winuser.h:1697
HWND WINAPI GetWindow(_In_ HWND, _In_ UINT)
#define WM_NCLBUTTONDOWN
Definition: winuser.h:1691
#define WM_MBUTTONDOWN
Definition: winuser.h:1781
#define WM_NCRBUTTONDOWN
Definition: winuser.h:1694

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 697 of file winhelp.c.

698{
700 BOOL bPrimary, bPopup, bReUsed = FALSE;
701 HICON hIcon;
702 HWND hTextWnd = NULL;
703
704 bPrimary = !lstrcmpiA(wpage->wininfo->name, "main");
705 bPopup = !bPrimary && (wpage->wininfo->win_style & WS_POPUP);
706
707 if (!bPopup)
708 {
709 for (win = Globals.win_list; win; win = win->next)
710 {
711 if (!lstrcmpiA(win->info->name, wpage->wininfo->name))
712 {
713 if (win->page == wpage->page && win->info == wpage->wininfo)
714 {
715 /* see #22979, some hlp files have a macro (run at page opening), which
716 * jumps to the very same page
717 * Exit gracefully in that case
718 */
719 return TRUE;
720 }
722 bReUsed = TRUE;
723 SetWindowTextA(win->hMainWnd, WINHELP_GetCaption(wpage));
724 if (win->info != wpage->wininfo)
725 {
726 POINT pt = {0, 0};
727 SIZE sz = {0, 0};
729
730 if (wpage->wininfo->origin.x != CW_USEDEFAULT &&
731 wpage->wininfo->origin.y != CW_USEDEFAULT)
732 {
733 pt = wpage->wininfo->origin;
734 flags &= ~SWP_NOSIZE;
735 }
736 if (wpage->wininfo->size.cx != CW_USEDEFAULT &&
737 wpage->wininfo->size.cy != CW_USEDEFAULT)
738 {
739 sz = wpage->wininfo->size;
740 flags &= ~SWP_NOMOVE;
741 }
742 SetWindowPos(win->hMainWnd, HWND_TOP, pt.x, pt.y, sz.cx, sz.cy, flags);
743 }
744
745 if (wpage->page && win->page && wpage->page->file != win->page->file)
747 WINHELP_InitFonts(win->hMainWnd);
748
749 win->page = wpage->page;
750 win->info = wpage->wininfo;
751 hTextWnd = GetDlgItem(win->hMainWnd, CTL_ID_TEXT);
752 WINHELP_SetupText(hTextWnd, win, wpage->relative);
753
754 InvalidateRect(win->hMainWnd, NULL, TRUE);
755 if (win->hHistoryWnd) InvalidateRect(win->hHistoryWnd, NULL, TRUE);
756
757 break;
758 }
759 }
760 }
761
762 if (!win)
763 {
764 /* Initialize WINHELP_WINDOW struct */
766 if (!win) return FALSE;
767 win->next = Globals.win_list;
769
770 win->hHandCur = LoadCursorW(0, (LPWSTR)IDC_HAND);
771 win->back.index = 0;
772 win->font_scale = 1;
774 }
775 win->page = wpage->page;
776 win->info = wpage->wininfo;
778
779 if (!bPopup && wpage->page && remember)
780 {
782 }
783
784 if (bPopup)
786 else
788
789 /* Initialize default pushbuttons */
790 if (bPrimary && wpage->page)
791 {
793
795 MACRO_CreateButton("BTN_CONTENTS", buffer, "Contents()");
797 MACRO_CreateButton("BTN_INDEX", buffer, "Finder()");
799 MACRO_CreateButton("BTN_BACK", buffer, "Back()");
800 if (win->back.index <= 1) MACRO_DisableButton("BTN_BACK");
801 }
802
803 if (!bReUsed)
804 {
805 win->hMainWnd = CreateWindowExA((bPopup) ? WS_EX_TOOLWINDOW : 0, MAIN_WIN_CLASS_NAME,
806 WINHELP_GetCaption(wpage),
807 bPrimary ? WS_OVERLAPPEDWINDOW : wpage->wininfo->win_style,
808 wpage->wininfo->origin.x, wpage->wininfo->origin.y,
809 wpage->wininfo->size.cx, wpage->wininfo->size.cy,
810 bPopup ? Globals.active_win->hMainWnd : NULL,
813 if (!bPopup)
814 /* Create button box and text Window */
816 0, 0, 0, 0, win->hMainWnd, (HMENU)CTL_ID_BUTTON, Globals.hInstance, NULL);
817
820 0, 0, 0, 0, win->hMainWnd, (HMENU)CTL_ID_TEXT, Globals.hInstance, NULL);
821 SendMessageW(hTextWnd, EM_SETEVENTMASK, 0,
822 SendMessageW(hTextWnd, EM_GETEVENTMASK, 0, 0) | ENM_MOUSEEVENTS);
823 win->origRicheditWndProc = (WNDPROC)SetWindowLongPtrA(hTextWnd, GWLP_WNDPROC,
825 }
826
827 hIcon = (wpage->page) ? wpage->page->file->hIcon : NULL;
830 SendMessageW(win->hMainWnd, WM_SETICON, ICON_SMALL, (DWORD_PTR)hIcon);
831
832 /* Initialize file specific pushbuttons */
833 if (!(wpage->wininfo->win_style & WS_POPUP) && wpage->page)
834 {
835 HLPFILE_MACRO *macro;
836 for (macro = wpage->page->file->first_macro; macro; macro = macro->next)
838
839 for (macro = wpage->page->first_macro; macro; macro = macro->next)
841 }
842 /* See #17681, in some cases, the newly created window is closed by the macros it contains
843 * (braindead), so deal with this case
844 */
845 for (win = Globals.win_list; win; win = win->next)
846 {
847 if (!lstrcmpiA(win->info->name, wpage->wininfo->name)) break;
848 }
849 if (!win || !WINHELP_ReleaseWindow(win)) return TRUE;
850
851 if (bPopup)
852 {
853 DWORD mask = SendMessageW(hTextWnd, EM_GETEVENTMASK, 0, 0);
854
855 win->font_scale = Globals.active_win->font_scale;
856 WINHELP_SetupText(hTextWnd, win, wpage->relative);
857
858 /* we need the window to be shown for richedit to compute the size */
859 ShowWindow(win->hMainWnd, nCmdShow);
861 SendMessageW(hTextWnd, EM_REQUESTRESIZE, 0, 0);
862 SendMessageW(hTextWnd, EM_SETEVENTMASK, 0, mask);
863 }
864 else
865 {
866 WINHELP_SetupText(hTextWnd, win, wpage->relative);
868 ShowWindow(win->hMainWnd, nCmdShow);
869 }
870
871 return TRUE;
872}
#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:462
#define CTL_ID_TEXT
Definition: winhelp.c:51
WINHELP_WINDOW * WINHELP_GrabWindow(WINHELP_WINDOW *win)
Definition: winhelp.c:512
static char * WINHELP_GetCaption(WINHELP_WNDPAGE *wpage)
Definition: winhelp.c:585
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:669
void WINHELP_LayoutMainWindow(WINHELP_WINDOW *win)
Definition: winhelp.c:433
void WINHELP_DeleteBackSet(WINHELP_WINDOW *win)
Definition: winhelp.c:480
static void WINHELP_RememberPage(WINHELP_WINDOW *win, WINHELP_WNDPAGE *wpage)
Definition: winhelp.c:591
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
#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
int WINAPI lstrcmpiA(LPCSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:42
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:84
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:1243
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:2172
#define WS_EX_TOOLWINDOW
Definition: winuser.h:404
#define SM_CYSMICON
Definition: winuser.h:1012
#define SWP_NOSIZE
Definition: winuser.h:1244
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:2074
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define SM_CXSMICON
Definition: winuser.h:1011
#define LR_SHARED
Definition: winuser.h:1099
#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 1541 of file winhelp.c.

1542{
1543 HPROPSHEETPAGE psPage[3];
1544 PROPSHEETPAGEA psp;
1545 PROPSHEETHEADERA psHead;
1546 struct index_data id;
1547 char buf[256];
1548
1551 else
1552 return FALSE;
1553
1554 if (id.hlpfile->kwbtree == NULL)
1555 {
1556 WINE_TRACE("No index provided\n");
1557 return FALSE;
1558 }
1559
1561
1562 id.jump = FALSE;
1563 memset(&psp, 0, sizeof(psp));
1564 psp.dwSize = sizeof(psp);
1565 psp.dwFlags = 0;
1567
1569 psp.lParam = (LPARAM)&id;
1571 psPage[0] = CreatePropertySheetPageA(&psp);
1572
1574 psp.lParam = (LPARAM)&id;
1576 psPage[1] = CreatePropertySheetPageA(&psp);
1577
1578 memset(&psHead, 0, sizeof(psHead));
1579 psHead.dwSize = sizeof(psHead);
1580
1583
1584 psHead.pszCaption = buf;
1585 psHead.nPages = 2;
1586 psHead.u2.nStartPage = is_search ? 1 : 0;
1588 psHead.u3.phpage = psPage;
1589 psHead.dwFlags = PSH_NOAPPLYNOW;
1590
1591 PropertySheetA(&psHead);
1592 if (id.jump)
1593 {
1594 WINE_TRACE("got %d as an offset\n", id.offset);
1597 }
1598 return TRUE;
1599}
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:878
static INT_PTR CALLBACK WINHELP_SearchDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
Definition: winhelp.c:1292
static INT_PTR CALLBACK WINHELP_IndexDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
Definition: winhelp.c:1225
VOID WINAPI InitCommonControls(void)
Definition: commctrl.c:863
INT_PTR WINAPI PropertySheetA(LPCPROPSHEETHEADERA lppsh)
Definition: propsheet.c:2864
HPROPSHEETPAGE WINAPI CreatePropertySheetPageA(LPCPROPSHEETPAGEA lpPropSheetPage)
Definition: propsheet.c:2991
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:1216
BOOL jump
Definition: winhelp.c:1217
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:768

Referenced by MACRO_Finder(), and MACRO_Search().

◆ WINHELP_DeleteBackSet()

void WINHELP_DeleteBackSet ( WINHELP_WINDOW win)

Definition at line 480 of file winhelp.c.

481{
482 unsigned int i;
483
484 for (i = 0; i < win->back.index; i++)
485 {
486 HLPFILE_FreeHlpFile(win->back.set[i].page->file);
487 win->back.set[i].page = NULL;
488 }
489 win->back.index = 0;
490}
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 462 of file winhelp.c.

463{
465 WINHELP_BUTTON* bp;
466
467 for (b = win->first_button; b; b = bp)
468 {
469 DestroyWindow(b->hWnd);
470 bp = b->next;
472 }
473 win->first_button = NULL;
474}
#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 496 of file winhelp.c.

497{
498 HLPFILE_LINK* curr;
500
501 for (curr = page->first_link; curr; curr = next)
502 {
503 next = curr->next;
504 HeapFree(GetProcessHeap(), 0, curr);
505 }
506}
Definition: module.h:576

Referenced by WINHELP_DeleteWindow().

◆ WINHELP_DeleteWindow()

static void WINHELP_DeleteWindow ( WINHELP_WINDOW win)
static

Definition at line 539 of file winhelp.c.

540{
542 BOOL bExit;
543 HWND hTextWnd;
544
545 for (w = &Globals.win_list; *w; w = &(*w)->next)
546 {
547 if (*w == win)
548 {
549 *w = win->next;
550 break;
551 }
552 }
553 bExit = (Globals.wVersion >= 4 && !lstrcmpiA(win->info->name, "main"));
554
555 if (Globals.active_win == win)
556 {
558 if (Globals.win_list)
560 }
561
562 if (win == Globals.active_popup)
564
565 hTextWnd = GetDlgItem(win->hMainWnd, CTL_ID_TEXT);
566 SetWindowLongPtrA(hTextWnd, GWLP_WNDPROC, (LONG_PTR)win->origRicheditWndProc);
567
569
570 if (win->page) WINHELP_DeletePageLinks(win->page);
571 if (win->hHistoryWnd) DestroyWindow(win->hHistoryWnd);
572
573 DeleteObject(win->hBrush);
574
576
577 if (win->page) HLPFILE_FreeHlpFile(win->page->file);
579
580 if (bExit) MACRO_Exit();
581 if (!Globals.win_list)
583}
static void WINHELP_DeletePageLinks(HLPFILE_PAGE *page)
Definition: winhelp.c:496
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 629 of file winhelp.c.

630{
632 POINTL mouse_ptl, char_ptl, char_next_ptl;
633 DWORD cp;
634
635 if (!win->page) return NULL;
636
637 mouse_ptl.x = (short)LOWORD(pos);
638 mouse_ptl.y = (short)HIWORD(pos);
640 0, (LPARAM)&mouse_ptl);
641
642 for (link = win->page->first_link; link; link = link->next)
643 {
644 if (link->cpMin <= cp && cp <= link->cpMax)
645 {
646 /* check whether we're at end of line */
648 (LPARAM)&char_ptl, cp);
650 (LPARAM)&char_next_ptl, cp + 1);
651 if (link->bHotSpot)
652 {
654 if ((mouse_ptl.x < char_ptl.x + hslink->x) ||
655 (mouse_ptl.x >= char_ptl.x + hslink->x + hslink->width) ||
656 (mouse_ptl.y < char_ptl.y + hslink->y) ||
657 (mouse_ptl.y >= char_ptl.y + hslink->y + hslink->height))
658 continue;
659 break;
660 }
661 if (char_next_ptl.y != char_ptl.y || mouse_ptl.x >= char_next_ptl.x)
662 link = NULL;
663 break;
664 }
665 }
666 return link;
667}
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 585 of file winhelp.c.

586{
587 if (wpage->wininfo->caption[0]) return wpage->wininfo->caption;
588 return wpage->page->file->lpszTitle;
589}

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 298 of file winhelp.c.

300{
301 static HLPFILE_WINDOWINFO wi;
302
303 RECT parent_rect;
304
305 wi.type[0] = wi.name[0] = wi.caption[0] = '\0';
306
307 /* Calculate horizontal size and position of a popup window */
308 GetWindowRect(parent->hMainWnd, &parent_rect);
309 wi.size.cx = (parent_rect.right - parent_rect.left) / 2;
310 wi.size.cy = 10; /* need a non null value, so that borders are taken into account while computing */
311
312 wi.origin.x = (short)LOWORD(mouse);
313 wi.origin.y = (short)HIWORD(mouse);
314 ClientToScreen(parent->hMainWnd, &wi.origin);
315 wi.origin.x -= wi.size.cx / 2;
317 wi.origin.x = max(wi.origin.x, 0);
318
319 wi.style = SW_SHOW;
321 if (parent->page->file->has_popup_color)
322 wi.sr_color = parent->page->file->popup_color;
323 else
324 wi.sr_color = parent->info->sr_color;
325 wi.nsr_color = 0xFFFFFF;
326
327 return &wi;
328}
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:774
#define SM_CXSCREEN
Definition: winuser.h:958

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 {
278 char tmp[128];
279 LoadStringA(Globals.hInstance, STID_WINE_HELP, tmp, sizeof(tmp));
280 snprintf(mwi.caption, sizeof(mwi.caption), "%s %s - %s",
281 hlpfile->lpszTitle, tmp, hlpfile->lpszPath);
282 }
283 else
285 mwi.origin.x = mwi.origin.y = mwi.size.cx = mwi.size.cy = CW_USEDEFAULT;
286 mwi.style = SW_SHOW;
288 mwi.sr_color = mwi.nsr_color = 0xFFFFFF;
289 }
290 return &mwi;
291}
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 512 of file winhelp.c.

513{
514 WINE_TRACE("Grab %p#%d++\n", win, win->ref_count);
515 win->ref_count++;
516 return win;
517}

Referenced by WINHELP_CreateHelpWindow().

◆ WINHELP_HandleCommand()

static LRESULT WINHELP_HandleCommand ( HWND  hSrcWnd,
LPARAM  lParam 
)
static

Definition at line 352 of file winhelp.c.

353{
355 WINHELP* wh;
356
357 if (cds->dwData != 0xA1DE505)
358 {
359 WINE_FIXME("Wrong magic number (%08lx)\n", cds->dwData);
360 return 0;
361 }
362
363 wh = cds->lpData;
364
365 if (wh)
366 {
367 char* ptr = (wh->ofsFilename) ? (LPSTR)wh + wh->ofsFilename : NULL;
368
369 WINE_TRACE("Got[%u]: cmd=%u data=%08x fn=%s\n",
370 wh->size, wh->command, wh->data, debugstr_a(ptr));
371 switch (wh->command)
372 {
373 case HELP_CONTEXT:
374 if (ptr)
375 {
376 MACRO_JumpContext(ptr, "main", wh->data);
377 }
379 break;
380 case HELP_QUIT:
381 MACRO_Exit();
382 break;
383 case HELP_CONTENTS:
384 if (ptr)
385 {
386 MACRO_JumpContents(ptr, "main");
387 }
389 break;
390 case HELP_HELPONHELP:
391 MACRO_HelpOn();
393 break;
394 /* case HELP_SETINDEX: */
395 case HELP_SETCONTENTS:
396 if (ptr)
397 {
399 }
400 break;
402 if (ptr)
403 {
405 }
406 break;
407 /* case HELP_FORCEFILE:*/
408 /* case HELP_CONTEXTMENU: */
409 case HELP_FINDER:
410 /* in fact, should be the topic dialog box */
411 WINE_FIXME("HELP_FINDER: stub\n");
412 if (ptr)
413 {
414 MACRO_JumpHash(ptr, "main", 0);
415 }
416 break;
417 /* case HELP_WM_HELP: */
418 /* case HELP_SETPOPUP_POS: */
419 /* case HELP_KEY: */
420 /* case HELP_COMMAND: */
421 /* case HELP_PARTIALKEY: */
422 /* case HELP_MULTIKEY: */
423 /* case HELP_SETWINPOS: */
424 default:
425 WINE_FIXME("Unhandled command (%x) for remote winhelp control\n", wh->command);
426 break;
427 }
428 }
429 /* Always return success for now */
430 return 1;
431}
static BOOL WINHELP_HasWorkingWindow(void)
Definition: winhelp.c:340
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:332
WORD command
Definition: winhelp.c:333
WORD ofsFilename
Definition: winhelp.c:336
LONG data
Definition: winhelp.c:334
ULONG_PTR dwData
Definition: winuser.h:3000
#define HELP_CONTEXTPOPUP
Definition: winuser.h:2406
#define HELP_QUIT
Definition: winuser.h:2413
#define HELP_SETCONTENTS
Definition: winuser.h:2414
#define HELP_HELPONHELP
Definition: winuser.h:2408
#define HELP_CONTENTS
Definition: winuser.h:2404
#define HELP_CONTEXT
Definition: winuser.h:2405
#define HELP_FINDER
Definition: winuser.h:2418

Referenced by WINHELP_MainWndProc().

◆ WINHELP_HandleTextMouse()

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

Definition at line 894 of file winhelp.c.

895{
896 HLPFILE* hlpfile;
898 BOOL ret = FALSE;
899
900 switch (msg)
901 {
902 case WM_LBUTTONDOWN:
904 {
906
907 switch (link->cookie)
908 {
909 case hlp_link_link:
910 if ((hlpfile = WINHELP_LookupHelpFile(link->string)))
911 {
912 if (link->window == -1)
913 {
914 wi = win->info;
915 if (wi->win_style & WS_POPUP) wi = Globals.active_win->info;
916 }
917 else if (link->window < hlpfile->numWindows)
918 wi = &hlpfile->windows[link->window];
919 else
920 {
921 WINE_WARN("link to window %d/%d\n", link->window, hlpfile->numWindows);
922 break;
923 }
925 }
926 break;
927 case hlp_link_popup:
928 if ((hlpfile = WINHELP_LookupHelpFile(link->string)))
931 SW_NORMAL);
932 break;
933 case hlp_link_macro:
934 MACRO_ExecuteMacro(win, link->string);
935 break;
936 default:
937 WINE_FIXME("Unknown link cookie %d\n", link->cookie);
938 }
939 ret = TRUE;
940 }
941 break;
942 }
943 return ret;
944}
HLPFILE * WINHELP_LookupHelpFile(LPCSTR lpszFile)
Definition: winhelp.c:211
static HLPFILE_LINK * WINHELP_FindLink(WINHELP_WINDOW *win, LPARAM pos)
Definition: winhelp.c:629
static HLPFILE_WINDOWINFO * WINHELP_GetPopupWindowInfo(HLPFILE *hlpfile, WINHELP_WINDOW *parent, LPARAM mouse)
Definition: winhelp.c:298
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 340 of file winhelp.c.

341{
342 if (!Globals.active_win) return FALSE;
345}

Referenced by WINHELP_HandleCommand().

◆ WINHELP_HistoryWndProc()

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

Definition at line 1116 of file winhelp.c.

1117{
1119 PAINTSTRUCT ps;
1120 HDC hDc;
1122 unsigned int i;
1123 RECT r;
1124
1125 switch (msg)
1126 {
1127 case WM_NCCREATE:
1128 win = (WINHELP_WINDOW*)((LPCREATESTRUCTA)lParam)->lpCreateParams;
1130 win->hHistoryWnd = hWnd;
1131 break;
1132 case WM_CREATE:
1133 hDc = GetDC(hWnd);
1134 GetTextMetricsW(hDc, &tm);
1135 GetWindowRect(hWnd, &r);
1136
1137 r.right = r.left + 30 * tm.tmAveCharWidth;
1138 r.bottom = r.top + ARRAY_SIZE(Globals.history.set) * tm.tmHeight;
1140 if (r.left < 0) {r.right -= r.left; r.left = 0;}
1141 if (r.top < 0) {r.bottom -= r.top; r.top = 0;}
1142
1143 MoveWindow(hWnd, r.left, r.top, r.right, r.bottom, TRUE);
1144 ReleaseDC(hWnd, hDc);
1145 break;
1146 case WM_LBUTTONDOWN:
1147 hDc = GetDC(hWnd);
1148 GetTextMetricsW(hDc, &tm);
1149 i = HIWORD(lParam) / tm.tmHeight;
1150 if (i < Globals.history.index)
1152 ReleaseDC(hWnd, hDc);
1153 break;
1154 case WM_PAINT:
1155 hDc = BeginPaint(hWnd, &ps);
1156 GetTextMetricsW(hDc, &tm);
1157
1158 for (i = 0; i < Globals.history.index; i++)
1159 {
1161 {
1162 TextOutA(hDc, 0, i * tm.tmHeight,
1165 }
1166 else
1167 {
1168 char buffer[1024];
1169 const char* ptr1;
1170 const char* ptr2;
1171 unsigned len;
1172
1173 ptr1 = strrchr(Globals.history.set[i].page->file->lpszPath, '\\');
1174 if (!ptr1) ptr1 = Globals.history.set[i].page->file->lpszPath;
1175 else ptr1++;
1176 ptr2 = strrchr(ptr1, '.');
1177 len = ptr2 ? ptr2 - ptr1 : strlen(ptr1);
1178 if (len > sizeof(buffer)) len = sizeof(buffer);
1179 memcpy(buffer, ptr1, len);
1180 if (len < sizeof(buffer)) buffer[len++] = ':';
1182 TextOutA(hDc, 0, i * tm.tmHeight, buffer, strlen(buffer));
1183 }
1184 }
1185 EndPaint(hWnd, &ps);
1186 break;
1187 case WM_DESTROY:
1189 if (hWnd == win->hHistoryWnd)
1190 win->hHistoryWnd = 0;
1191 break;
1192 }
1193 return DefWindowProcA(hWnd, msg, wParam, lParam);
1194}
#define ARRAY_SIZE(A)
Definition: main.h:33
BOOL WINHELP_CreateHelpWindow(WINHELP_WNDPAGE *wpage, int nCmdShow, BOOL remember)
Definition: winhelp.c:697
#define lstrcpynA
Definition: compat.h:751
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
_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:1619
BOOL WINAPI AdjustWindowRect(_Inout_ LPRECT, _In_ DWORD, _In_ BOOL)
#define WM_CREATE
Definition: winuser.h:1607
LONG WINAPI GetWindowLongW(_In_ HWND, _In_ int)
#define WM_NCCREATE
Definition: winuser.h:1682
BOOL WINAPI EndPaint(_In_ HWND, _In_ const PAINTSTRUCT *)
#define WM_DESTROY
Definition: winuser.h:1608
HDC WINAPI BeginPaint(_In_ HWND, _Out_ LPPAINTSTRUCT)
#define SetWindowLongPtrW
Definition: winuser.h:5345
#define GWL_STYLE
Definition: winuser.h:851
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 1225 of file winhelp.c.

1226{
1227 static struct index_data* id;
1228 int sel;
1229
1230 switch (msg)
1231 {
1232 case WM_INITDIALOG:
1233 id = (struct index_data*)((PROPSHEETPAGEA*)lParam)->lParam;
1234 HLPFILE_BPTreeEnum(id->hlpfile->kwbtree, cb_KWBTree,
1236 id->jump = FALSE;
1237 id->offset = 1;
1238 return TRUE;
1239 case WM_COMMAND:
1240 switch (HIWORD(wParam))
1241 {
1242 case LBN_DBLCLK:
1243 if (LOWORD(wParam) == IDC_INDEXLIST)
1245 break;
1246 }
1247 break;
1248 case WM_NOTIFY:
1249 switch (((NMHDR*)lParam)->code)
1250 {
1251 case PSN_APPLY:
1253 if (sel != LB_ERR)
1254 {
1255 BYTE *p;
1256 int count;
1257
1259 count = *(short*)((char *)p + strlen((char *)p) + 1);
1260 if (count > 1)
1261 {
1262 MessageBoxA(hWnd, "count > 1 not supported yet", "Error", MB_OK | MB_ICONSTOP);
1264 return TRUE;
1265 }
1266 id->offset = *(ULONG*)((char *)p + strlen((char *)p) + 3);
1267 id->offset = *(long*)(id->hlpfile->kwdata + id->offset + 9);
1268 if (id->offset == 0xFFFFFFFF)
1269 {
1270 MessageBoxA(hWnd, "macro keywords not supported yet", "Error", MB_OK | MB_ICONSTOP);
1272 return TRUE;
1273 }
1274 id->jump = TRUE;
1276 }
1277 return TRUE;
1278 default:
1279 return FALSE;
1280 }
1281 break;
1282 default:
1283 break;
1284 }
1285 return FALSE;
1286}
static void cb_KWBTree(void *p, void **next, void *cookie)
Definition: winhelp.c:1202
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:2431
#define LB_GETITEMDATA
Definition: winuser.h:2040
#define LBN_DBLCLK
Definition: winuser.h:2070
int WINAPI MessageBoxA(_In_opt_ HWND hWnd, _In_opt_ LPCSTR lpText, _In_opt_ LPCSTR lpCaption, _In_ UINT uType)
#define WM_INITDIALOG
Definition: winuser.h:1738
LRESULT WINAPI SendDlgItemMessageW(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define MB_OK
Definition: winuser.h:789
#define DWLP_MSGRESULT
Definition: winuser.h:869
#define MB_ICONSTOP
Definition: winuser.h:802
#define LB_GETCURSEL
Definition: winuser.h:2038
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 433 of file winhelp.c.

434{
435 RECT rect, button_box_rect;
436 INT text_top = 0;
437 HWND hButtonBoxWnd = GetDlgItem(win->hMainWnd, CTL_ID_BUTTON);
438 HWND hTextWnd = GetDlgItem(win->hMainWnd, CTL_ID_TEXT);
439
440 GetClientRect(win->hMainWnd, &rect);
441
442 /* Update button box and text Window */
443 SetWindowPos(hButtonBoxWnd, HWND_TOP,
444 rect.left, rect.top,
445 rect.right - rect.left,
446 rect.bottom - rect.top, 0);
447
448 if (GetWindowRect(hButtonBoxWnd, &button_box_rect))
449 text_top = rect.top + button_box_rect.bottom - button_box_rect.top;
450
451 SetWindowPos(hTextWnd, HWND_TOP,
452 rect.left, text_top,
453 rect.right - rect.left,
454 rect.bottom - text_top, 0);
455
456}
& 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:816
#define MB_ICONQUESTION
Definition: winuser.h:788
#define IDYES
Definition: winuser.h:834

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 1318 of file winhelp.c.

1319{
1322 HWND hTextWnd;
1323 LRESULT ret;
1324
1325 if (WINHELP_CheckPopup(hWnd, msg, wParam, lParam, &ret)) return ret;
1326
1327 switch (msg)
1328 {
1329 case WM_NCCREATE:
1330 win = (WINHELP_WINDOW*) ((LPCREATESTRUCTA) lParam)->lpCreateParams;
1332 if (!win->page && Globals.isBook)
1334 win->hMainWnd = hWnd;
1335 break;
1336
1339 break;
1340
1341 case WM_COMMAND:
1343 switch (LOWORD(wParam))
1344 {
1345 /* Menu FILE */
1346 case MNID_FILE_OPEN: MACRO_FileOpen(); break;
1347 case MNID_FILE_PRINT: MACRO_Print(); break;
1348 case MNID_FILE_SETUP: MACRO_PrinterSetup(); break;
1349 case MNID_FILE_EXIT: MACRO_Exit(); break;
1350
1351 /* Menu EDIT */
1352 case MNID_EDIT_COPYDLG:
1354 break;
1355 case MNID_EDIT_ANNOTATE:MACRO_Annotate(); break;
1356
1357 /* Menu Bookmark */
1359
1360 /* Menu Help */
1361 case MNID_HELP_HELPON: MACRO_HelpOn(); break;
1362 case MNID_HELP_HELPTOP: MACRO_HelpOnTop(); break;
1363 case MNID_HELP_ABOUT: MACRO_About(); break;
1364
1365 /* Context help */
1366 case MNID_CTXT_ANNOTATE:MACRO_Annotate(); break;
1367 case MNID_CTXT_COPY: MACRO_CopyDialog(); break;
1368 case MNID_CTXT_PRINT: MACRO_Print(); break;
1369 case MNID_OPTS_HISTORY: MACRO_History(); break;
1373 if (win->font_scale != 0)
1374 {
1375 win->font_scale = 0;
1376 WINHELP_SetupText(GetDlgItem(hWnd, CTL_ID_TEXT), win, 0 /* FIXME */);
1377 }
1378 break;
1382 if (win->font_scale != 1)
1383 {
1384 win->font_scale = 1;
1385 WINHELP_SetupText(GetDlgItem(hWnd, CTL_ID_TEXT), win, 0 /* FIXME */);
1386 }
1387 break;
1391 if (win->font_scale != 2)
1392 {
1393 win->font_scale = 2;
1394 WINHELP_SetupText(GetDlgItem(hWnd, CTL_ID_TEXT), win, 0 /* FIXME */);
1395 }
1396 break;
1397
1398 default:
1399 /* Buttons */
1400 for (button = win->first_button; button; button = button->next)
1401 if (wParam == button->wParam) break;
1402 if (button)
1403 MACRO_ExecuteMacro(win, button->lpszMacro);
1404 else if (!HIWORD(wParam))
1407 break;
1408 }
1409 break;
1410/* EPP case WM_DESTROY: */
1411/* EPP if (Globals.hPopupWnd) DestroyWindow(Globals.hPopupWnd); */
1412/* EPP break; */
1413 case WM_COPYDATA:
1415
1416 case WM_CHAR:
1417 if (wParam == 3)
1418 {
1420 return 0;
1421 }
1422 break;
1423
1424 case WM_KEYDOWN:
1426 hTextWnd = GetDlgItem(win->hMainWnd, CTL_ID_TEXT);
1427
1428 switch (wParam)
1429 {
1430 case VK_UP:
1431 SendMessageW(hTextWnd, EM_SCROLL, SB_LINEUP, 0);
1432 return 0;
1433 case VK_DOWN:
1434 SendMessageW(hTextWnd, EM_SCROLL, SB_LINEDOWN, 0);
1435 return 0;
1436 case VK_PRIOR:
1437 SendMessageW(hTextWnd, EM_SCROLL, SB_PAGEUP, 0);
1438 return 0;
1439 case VK_NEXT:
1440 SendMessageW(hTextWnd, EM_SCROLL, SB_PAGEDOWN, 0);
1441 return 0;
1442 case VK_ESCAPE:
1443 MACRO_Exit();
1444 return 0;
1445 }
1446 break;
1447
1448 case WM_NOTIFY:
1449 if (wParam == CTL_ID_TEXT)
1450 {
1451 RECT rc;
1452
1453 switch (((NMHDR*)lParam)->code)
1454 {
1455 case EN_MSGFILTER:
1456 {
1457 const MSGFILTER* msgf = (const MSGFILTER*)lParam;
1458 switch (msgf->msg)
1459 {
1460 case WM_KEYUP:
1461 if (msgf->wParam == VK_ESCAPE)
1463 break;
1464 case WM_RBUTTONDOWN:
1465 {
1466 HMENU hMenu;
1467 POINT pt;
1468
1471 switch (win->font_scale)
1472 {
1473 case 0:
1476 break;
1477 default:
1478 WINE_FIXME("Unsupported %d\n", win->font_scale);
1479 /* fall through */
1480 case 1:
1483 break;
1484 case 2:
1487 break;
1488 }
1489 pt.x = (int)(short)LOWORD(msgf->lParam);
1490 pt.y = (int)(short)HIWORD(msgf->lParam);
1493 pt.x, pt.y, 0, hWnd, NULL);
1494 DestroyMenu(hMenu);
1495 }
1496 break;
1497 default:
1499 msgf->msg, msgf->lParam);
1500 }
1501 }
1502 break;
1503
1504 case EN_REQUESTRESIZE:
1505 rc = ((REQRESIZE*)lParam)->rc;
1508 FALSE);
1509 SetWindowPos(win->hMainWnd, HWND_TOP, 0, 0,
1510 rc.right - rc.left, rc.bottom - rc.top,
1513 break;
1514 }
1515 }
1516 break;
1517
1518 case WM_INITMENUPOPUP:
1521 (win->font_scale == 0) ? MF_CHECKED : MF_UNCHECKED);
1523 (win->font_scale == 1) ? MF_CHECKED : MF_UNCHECKED);
1525 (win->font_scale == 2) ? MF_CHECKED : MF_UNCHECKED);
1526 break;
1527 case WM_DESTROY:
1530 break;
1531 }
1532 return DefWindowProcA(hWnd, msg, wParam, lParam);
1533}
static LRESULT WINHELP_HandleCommand(HWND hSrcWnd, LPARAM lParam)
Definition: winhelp.c:352
static void WINHELP_DeleteWindow(WINHELP_WINDOW *win)
Definition: winhelp.c:539
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:3156
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:1715
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:2382
DWORD WINAPI CheckMenuItem(_In_ HMENU, _In_ UINT, _In_ UINT)
HMENU WINAPI GetSubMenu(_In_ HMENU, _In_ int)
#define WM_INITMENUPOPUP
Definition: winuser.h:1745
#define TPM_LEFTALIGN
Definition: winuser.h:2376
#define EM_SCROLL
Definition: winuser.h:2006
#define SB_PAGEDOWN
Definition: winuser.h:569
#define WM_COPYDATA
Definition: winuser.h:1663
#define SB_LINEDOWN
Definition: winuser.h:565
#define WM_CHAR
Definition: winuser.h:1716
BOOL WINAPI DestroyMenu(_In_ HMENU)
#define WM_COPY
Definition: winuser.h:1861
BOOL WINAPI TrackPopupMenu(_In_ HMENU, _In_ UINT, _In_ int, _In_ int, _Reserved_ int, _In_ HWND, _Reserved_ LPCRECT)
#define SWP_NOZORDER
Definition: winuser.h:1246
#define WM_WINDOWPOSCHANGED
Definition: winuser.h:1661
#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:1799
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 878 of file winhelp.c.

881{
882 WINHELP_WNDPAGE wpage;
883
884 wpage.page = lookup(hlpfile, val, &wpage.relative);
885 if (wpage.page) wpage.page->file->wRefCount++;
886 wpage.wininfo = wi;
887 return WINHELP_CreateHelpWindow(&wpage, nCmdShow, TRUE);
888}
static ULONG lookup[16]
Definition: vga.c:38
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 1605 of file winhelp.c.

1606{
1607 WNDCLASSEXA class_main, class_button_box, class_history;
1608
1609 class_main.cbSize = sizeof(class_main);
1610 class_main.style = CS_HREDRAW | CS_VREDRAW;
1611 class_main.lpfnWndProc = WINHELP_MainWndProc;
1612 class_main.cbClsExtra = 0;
1613 class_main.cbWndExtra = sizeof(WINHELP_WINDOW *);
1614 class_main.hInstance = Globals.hInstance;
1616 class_main.hCursor = LoadCursorW(0, (LPWSTR)IDC_ARROW);
1617 class_main.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
1618 class_main.lpszMenuName = 0;
1622 LR_SHARED);
1623
1624 class_button_box = class_main;
1625 class_button_box.lpfnWndProc = WINHELP_ButtonBoxWndProc;
1626 class_button_box.cbWndExtra = 0;
1627 class_button_box.hbrBackground = (HBRUSH)(COLOR_BTNFACE+1);
1628 class_button_box.lpszClassName = BUTTON_BOX_WIN_CLASS_NAME;
1629
1630 class_history = class_main;
1631 class_history.lpfnWndProc = WINHELP_HistoryWndProc;
1632 class_history.lpszClassName = HISTORY_WIN_CLASS_NAME;
1633
1634 return (RegisterClassExA(&class_main) &&
1635 RegisterClassExA(&class_button_box) &&
1636 RegisterClassExA(&class_history));
1637}
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:1318
static LRESULT CALLBACK WINHELP_ButtonBoxWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
Definition: winhelp.c:1022
static LRESULT CALLBACK WINHELP_HistoryWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
Definition: winhelp.c:1116
int cbClsExtra
Definition: winuser.h:3203
HINSTANCE hInstance
Definition: winuser.h:3205
HCURSOR hCursor
Definition: winuser.h:3207
LPCSTR lpszMenuName
Definition: winuser.h:3209
HICON hIconSm
Definition: winuser.h:3211
UINT style
Definition: winuser.h:3201
int cbWndExtra
Definition: winuser.h:3204
UINT cbSize
Definition: winuser.h:3200
WNDPROC lpfnWndProc
Definition: winuser.h:3202
LPCSTR lpszClassName
Definition: winuser.h:3210
HICON hIcon
Definition: winuser.h:3206
HBRUSH hbrBackground
Definition: winuser.h:3208
#define CS_VREDRAW
Definition: winuser.h:658
#define COLOR_WINDOW
Definition: winuser.h:917
#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:2044
#define COLOR_BTNFACE
Definition: winuser.h:927

Referenced by WinMain().

◆ WINHELP_ReleaseWindow()

BOOL WINHELP_ReleaseWindow ( WINHELP_WINDOW win)

Definition at line 523 of file winhelp.c.

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

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 591 of file winhelp.c.

592{
593 unsigned num;
594
595 if (!Globals.history.index || Globals.history.set[0].page != wpage->page)
596 {
598 /* we're full, remove latest entry */
599 if (Globals.history.index == num)
600 {
603 }
605 Globals.history.index * sizeof(Globals.history.set[0]));
606 Globals.history.set[0] = *wpage;
608 wpage->page->file->wRefCount++;
609 }
610 if (win->hHistoryWnd) InvalidateRect(win->hHistoryWnd, NULL, TRUE);
611
612 num = ARRAY_SIZE(win->back.set);
613 if (win->back.index == num)
614 {
615 /* we're full, remove latest entry */
616 HLPFILE_FreeHlpFile(win->back.set[0].page->file);
617 memmove(&win->back.set[0], &win->back.set[1],
618 (num - 1) * sizeof(win->back.set[0]));
619 win->back.index--;
620 }
621 win->back.set[win->back.index++] = *wpage;
622 wpage->page->file->wRefCount++;
623}
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 669 of file winhelp.c.

671{
673 DWORD messagePos;
674 POINT pt;
675 switch(msg)
676 {
677 case WM_SETCURSOR:
678 messagePos = GetMessagePos();
679 pt.x = (short)LOWORD(messagePos);
680 pt.y = (short)HIWORD(messagePos);
682 if (win->page && WINHELP_FindLink(win, MAKELPARAM(pt.x, pt.y)))
683 {
684 SetCursor(win->hHandCur);
685 return 0;
686 }
687 /* fall through */
688 default:
689 return CallWindowProcA(win->origRicheditWndProc, hWnd, msg, wParam, lParam);
690 }
691}
#define MAKELPARAM(l, h)
Definition: winuser.h:4007
DWORD WINAPI GetMessagePos(void)
Definition: message.c:1351
HCURSOR WINAPI SetCursor(_In_opt_ HCURSOR)
#define WM_SETCURSOR
Definition: winuser.h:1635
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 1292 of file winhelp.c.

1293{
1294 switch (msg)
1295 {
1296 case WM_INITDIALOG:
1297 return TRUE;
1298 case WM_NOTIFY:
1299 switch (((NMHDR*)lParam)->code)
1300 {
1301 case PSN_APPLY:
1303 return TRUE;
1304 default:
1305 return FALSE;
1306 }
1307 break;
1308 default:
1309 break;
1310 }
1311 return FALSE;
1312}

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:1616
#define RDW_FRAME
Definition: winuser.h:1211
#define RDW_INVALIDATE
Definition: winuser.h:1213
#define WM_SETREDRAW
Definition: winuser.h:1615
__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 1643 of file winhelp.c.

1644{
1645 MSG msg;
1646 LONG lHash = 0;
1647 HLPFILE* hlpfile;
1648 static CHAR default_wndname[] = "main";
1649 LPSTR wndname = default_wndname;
1651 HACCEL hAccel;
1652
1654
1655 if (LoadLibraryA("riched20.dll") == NULL)
1658
1659 /* Get options */
1660 while (*cmdline && (*cmdline == ' ' || *cmdline == '-'))
1661 {
1662 CHAR option;
1663 LPCSTR topic_id;
1664 if (*cmdline++ == ' ') continue;
1665
1666 option = *cmdline;
1667 if (option) cmdline++;
1668 while (*cmdline == ' ') cmdline++;
1669 switch (option)
1670 {
1671 case 'i':
1672 case 'I':
1673 topic_id = cmdline;
1674 while (*cmdline && *cmdline != ' ') cmdline++;
1675 if (*cmdline) *cmdline++ = '\0';
1676 lHash = HLPFILE_Hash(topic_id);
1677 break;
1678
1679 case '3':
1680 case '4':
1681 Globals.wVersion = option - '0';
1682 break;
1683
1684 case 'x':
1685 show = SW_HIDE;
1687 break;
1688
1689 default:
1690 WINE_FIXME("Unsupported cmd line: %s\n", debugstr_a(cmdline));
1691 break;
1692 }
1693 }
1694
1695 /* Create primary window */
1697 {
1698 WINE_FIXME("Couldn't register classes\n");
1699 return 0;
1700 }
1701
1702 if (*cmdline)
1703 {
1704 char* ptr;
1705 if ((*cmdline == '"') && (ptr = strchr(cmdline+1, '"')))
1706 {
1707 cmdline++;
1708 *ptr = '\0';
1709 }
1710 if ((ptr = strchr(cmdline, '>')))
1711 {
1712 *ptr = '\0';
1713 wndname = ptr + 1;
1714 }
1716 if (!hlpfile) return 0;
1717 }
1718 else hlpfile = NULL;
1720 WINHELP_GetWindowInfo(hlpfile, wndname), show);
1721
1722 /* Message loop */
1724 while ((Globals.win_list || Globals.active_popup) && GetMessageW(&msg, 0, 0, 0))
1725 {
1728 {
1731 }
1732 }
1733 for (dll = Globals.dlls; dll; dll = dll->next)
1734 {
1735 if (dll->class & DC_INITTERM) dll->handler(DW_TERM, 0, 0);
1736 }
1737 return 0;
1738}
char * strchr(const char *String, int ch)
Definition: utclib.c:501
static BOOL WINHELP_RegisterWinClasses(void)
Definition: winhelp.c:1605
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:767
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