2 * Help Viewer Implementation
4 * Copyright 2005 James Hawkins
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
31 #include "wine/unicode.h"
35 #include "webbrowser.h"
37 /* Window type defaults */
39 #define WINTYPE_DEFAULT_X 280
40 #define WINTYPE_DEFAULT_Y 100
41 #define WINTYPE_DEFAULT_WIDTH 740
42 #define WINTYPE_DEFAULT_HEIGHT 640
43 #define WINTYPE_DEFAULT_NAVWIDTH 250
45 typedef struct tagHHInfo
47 HH_WINTYPEW *pHHWinType;
56 extern HINSTANCE hhctrl_hinstance;
58 static LPWSTR HH_ANSIToUnicode(LPCSTR ansi)
63 count = MultiByteToWideChar(CP_ACP, 0, ansi, -1, NULL, 0);
64 unicode = HeapAlloc(GetProcessHeap(), 0, count * sizeof(WCHAR));
65 MultiByteToWideChar(CP_ACP, 0, ansi, -1, unicode, count);
70 /* Loads a string from the resource file */
71 static LPWSTR HH_LoadString(DWORD dwID)
76 iSize = LoadStringW(hhctrl_hinstance, dwID, NULL, 0);
77 iSize += 2; /* some strings (tab text) needs double-null termination */
79 string = HeapAlloc(GetProcessHeap(), 0, iSize * sizeof(WCHAR));
80 LoadStringW(hhctrl_hinstance, dwID, string, iSize);
87 static const WCHAR szChildClass[] = {
88 'H','H',' ','C','h','i','l','d',0
91 static const WCHAR szEmpty[] = {0};
93 static void Child_OnPaint(HWND hWnd)
99 hdc = BeginPaint(hWnd, &ps);
101 /* Only paint the Navigation pane, identified by the fact
102 * that it has a child window
104 if (GetWindow(hWnd, GW_CHILD))
106 GetClientRect(hWnd, &rc);
108 /* set the border color */
109 SelectObject(hdc, GetStockObject(DC_PEN));
110 SetDCPenColor(hdc, GetSysColor(COLOR_BTNSHADOW));
112 /* Draw the top border */
113 LineTo(hdc, rc.right, 0);
115 SelectObject(hdc, GetStockObject(WHITE_PEN));
116 MoveToEx(hdc, 0, 1, NULL);
117 LineTo(hdc, rc.right, 1);
123 LRESULT CALLBACK Child_WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
131 return DefWindowProcW(hWnd, message, wParam, lParam);
137 static void HH_RegisterChildWndClass(HHInfo *pHHInfo)
141 wcex.cbSize = sizeof(WNDCLASSEXW);
143 wcex.lpfnWndProc = (WNDPROC)Child_WndProc;
146 wcex.hInstance = pHHInfo->hInstance;
147 wcex.hIcon = LoadIconW(NULL, (LPCWSTR)IDI_APPLICATION);
148 wcex.hCursor = LoadCursorW(NULL, (LPCWSTR)IDC_ARROW);
149 wcex.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1);
150 wcex.lpszMenuName = NULL;
151 wcex.lpszClassName = szChildClass;
152 wcex.hIconSm = LoadIconW(NULL, (LPCWSTR)IDI_APPLICATION);
154 RegisterClassExW(&wcex);
161 static void TB_OnClick(HWND hWnd, DWORD dwID)
163 HHInfo *pHHInfo = (HHInfo *)GetWindowLongPtrW(hWnd, GWLP_USERDATA);
168 WB_DoPageAction(pHHInfo->pWBInfo, WB_STOP);
171 WB_DoPageAction(pHHInfo->pWBInfo, WB_REFRESH);
174 WB_DoPageAction(pHHInfo->pWBInfo, WB_GOBACK);
178 WCHAR szUrl[MAX_PATH];
180 CHM_CreateITSUrl(pHHInfo->pCHMInfo, pHHInfo->pHHWinType->pszHome, szUrl);
181 WB_Navigate(pHHInfo->pWBInfo, szUrl);
185 WB_DoPageAction(pHHInfo->pWBInfo, WB_GOFORWARD);
192 case IDTB_BROWSE_FWD:
193 case IDTB_BROWSE_BACK:
204 static void TB_AddButton(TBBUTTON *pButtons, DWORD dwIndex, DWORD dwID)
206 /* FIXME: Load the correct button bitmaps */
207 pButtons[dwIndex].iBitmap = STD_PRINT;
208 pButtons[dwIndex].idCommand = dwID;
209 pButtons[dwIndex].fsState = TBSTATE_ENABLED;
210 pButtons[dwIndex].fsStyle = BTNS_BUTTON;
211 pButtons[dwIndex].dwData = 0;
212 pButtons[dwIndex].iString = 0;
215 static void TB_AddButtonsFromFlags(TBBUTTON *pButtons, DWORD dwButtonFlags, LPDWORD pdwNumButtons)
219 if (dwButtonFlags & HHWIN_BUTTON_EXPAND)
220 TB_AddButton(pButtons, (*pdwNumButtons)++, IDTB_EXPAND);
222 if (dwButtonFlags & HHWIN_BUTTON_BACK)
223 TB_AddButton(pButtons, (*pdwNumButtons)++, IDTB_BACK);
225 if (dwButtonFlags & HHWIN_BUTTON_FORWARD)
226 TB_AddButton(pButtons, (*pdwNumButtons)++, IDTB_FORWARD);
228 if (dwButtonFlags & HHWIN_BUTTON_STOP)
229 TB_AddButton(pButtons, (*pdwNumButtons)++, IDTB_STOP);
231 if (dwButtonFlags & HHWIN_BUTTON_REFRESH)
232 TB_AddButton(pButtons, (*pdwNumButtons)++, IDTB_REFRESH);
234 if (dwButtonFlags & HHWIN_BUTTON_HOME)
235 TB_AddButton(pButtons, (*pdwNumButtons)++, IDTB_HOME);
237 if (dwButtonFlags & HHWIN_BUTTON_SYNC)
238 TB_AddButton(pButtons, (*pdwNumButtons)++, IDTB_SYNC);
240 if (dwButtonFlags & HHWIN_BUTTON_OPTIONS)
241 TB_AddButton(pButtons, (*pdwNumButtons)++, IDTB_OPTIONS);
243 if (dwButtonFlags & HHWIN_BUTTON_PRINT)
244 TB_AddButton(pButtons, (*pdwNumButtons)++, IDTB_PRINT);
246 if (dwButtonFlags & HHWIN_BUTTON_JUMP1)
247 TB_AddButton(pButtons, (*pdwNumButtons)++, IDTB_JUMP1);
249 if (dwButtonFlags & HHWIN_BUTTON_JUMP2)
250 TB_AddButton(pButtons,(*pdwNumButtons)++, IDTB_JUMP2);
252 if (dwButtonFlags & HHWIN_BUTTON_ZOOM)
253 TB_AddButton(pButtons, (*pdwNumButtons)++, IDTB_ZOOM);
255 if (dwButtonFlags & HHWIN_BUTTON_TOC_NEXT)
256 TB_AddButton(pButtons, (*pdwNumButtons)++, IDTB_TOC_NEXT);
258 if (dwButtonFlags & HHWIN_BUTTON_TOC_PREV)
259 TB_AddButton(pButtons, (*pdwNumButtons)++, IDTB_TOC_PREV);
262 static BOOL HH_AddToolbar(HHInfo *pHHInfo)
265 HWND hwndParent = pHHInfo->pHHWinType->hwndHelp;
267 TBBUTTON buttons[IDTB_TOC_PREV - IDTB_EXPAND];
269 DWORD dwStyles, dwExStyles;
270 DWORD dwNumButtons, dwIndex;
272 if (pHHInfo->pHHWinType->fsWinProperties & HHWIN_PARAM_TB_FLAGS)
273 toolbarFlags = pHHInfo->pHHWinType->fsToolBarFlags;
275 toolbarFlags = HHWIN_DEF_BUTTONS;
277 TB_AddButtonsFromFlags(buttons, toolbarFlags, &dwNumButtons);
279 dwStyles = WS_CHILDWINDOW | WS_VISIBLE | TBSTYLE_FLAT |
280 TBSTYLE_WRAPABLE | TBSTYLE_TOOLTIPS | CCS_NODIVIDER;
281 dwExStyles = WS_EX_LEFT | WS_EX_LTRREADING | WS_EX_RIGHTSCROLLBAR;
283 hToolbar = CreateWindowExW(dwExStyles, TOOLBARCLASSNAMEW, NULL, dwStyles,
284 0, 0, 0, 0, hwndParent, NULL,
285 pHHInfo->hInstance, NULL);
289 SendMessageW(hToolbar, TB_SETBITMAPSIZE, 0, MAKELONG(ICON_SIZE, ICON_SIZE));
290 SendMessageW(hToolbar, TB_BUTTONSTRUCTSIZE, sizeof(TBBUTTON), 0);
291 SendMessageW(hToolbar, WM_SETFONT, (WPARAM)pHHInfo->hFont, TRUE);
293 /* FIXME: Load correct icons for all buttons */
294 tbAB.hInst = HINST_COMMCTRL;
295 tbAB.nID = IDB_STD_LARGE_COLOR;
296 SendMessageW(hToolbar, TB_ADDBITMAP, 0, (LPARAM)&tbAB);
298 for (dwIndex = 0; dwIndex < dwNumButtons; dwIndex++)
300 LPWSTR szBuf = HH_LoadString(buttons[dwIndex].idCommand);
301 DWORD dwLen = strlenW(szBuf);
302 szBuf[dwLen + 2] = 0; /* Double-null terminate */
304 buttons[dwIndex].iString = (DWORD)SendMessageW(hToolbar, TB_ADDSTRINGW, 0, (LPARAM)szBuf);
305 HeapFree(GetProcessHeap(), 0, szBuf);
308 SendMessageW(hToolbar, TB_ADDBUTTONSW, dwNumButtons, (LPARAM)&buttons);
309 SendMessageW(hToolbar, TB_AUTOSIZE, 0, 0);
310 ShowWindow(hToolbar, SW_SHOW);
312 pHHInfo->pHHWinType->hwndToolBar = hToolbar;
316 /* Navigation Pane */
318 #define TAB_TOP_PADDING 8
319 #define TAB_RIGHT_PADDING 4
321 static void NP_GetNavigationRect(HHInfo *pHHInfo, RECT *rc)
323 HWND hwndParent = pHHInfo->pHHWinType->hwndHelp;
324 HWND hwndToolbar = pHHInfo->pHHWinType->hwndToolBar;
325 RECT rectWND, rectTB;
327 GetClientRect(hwndParent, &rectWND);
328 GetClientRect(hwndToolbar, &rectTB);
331 rc->top = rectTB.bottom;
332 rc->bottom = rectWND.bottom - rectTB.bottom;
334 if (pHHInfo->pHHWinType->fsValidMembers & HHWIN_PARAM_NAV_WIDTH)
335 rc->right = pHHInfo->pHHWinType->iNavWidth;
337 rc->right = WINTYPE_DEFAULT_NAVWIDTH;
340 static void NP_CreateTab(HINSTANCE hInstance, HWND hwndTabCtrl, DWORD dwStrID, DWORD dwIndex)
343 LPWSTR tabText = HH_LoadString(dwStrID);
345 tie.mask = TCIF_TEXT;
346 tie.pszText = tabText;
348 TabCtrl_InsertItemW(hwndTabCtrl, dwIndex, &tie);
349 HeapFree(GetProcessHeap(), 0, tabText);
352 static BOOL HH_AddNavigationPane(HHInfo *pHHInfo)
354 HWND hWnd, hwndTabCtrl;
355 HWND hwndParent = pHHInfo->pHHWinType->hwndHelp;
356 DWORD dwStyles = WS_CHILDWINDOW | WS_VISIBLE;
357 DWORD dwExStyles = WS_EX_LEFT | WS_EX_LTRREADING | WS_EX_RIGHTSCROLLBAR;
361 NP_GetNavigationRect(pHHInfo, &rc);
363 hWnd = CreateWindowExW(dwExStyles, szChildClass, szEmpty, dwStyles,
364 rc.left, rc.top, rc.right, rc.bottom,
365 hwndParent, NULL, pHHInfo->hInstance, NULL);
369 hwndTabCtrl = CreateWindowExW(dwExStyles, WC_TABCONTROLW, szEmpty, dwStyles,
371 rc.right - TAB_RIGHT_PADDING,
372 rc.bottom - TAB_TOP_PADDING,
373 hWnd, NULL, pHHInfo->hInstance, NULL);
377 if (*pHHInfo->pHHWinType->pszToc)
378 NP_CreateTab(pHHInfo->hInstance, hwndTabCtrl, IDS_CONTENTS, dwIndex++);
380 if (*pHHInfo->pHHWinType->pszIndex)
381 NP_CreateTab(pHHInfo->hInstance, hwndTabCtrl, IDS_INDEX, dwIndex++);
383 if (pHHInfo->pHHWinType->fsWinProperties & HHWIN_PROP_TAB_SEARCH)
384 NP_CreateTab(pHHInfo->hInstance, hwndTabCtrl, IDS_SEARCH, dwIndex++);
386 if (pHHInfo->pHHWinType->fsWinProperties & HHWIN_PROP_TAB_FAVORITES)
387 NP_CreateTab(pHHInfo->hInstance, hwndTabCtrl, IDS_FAVORITES, dwIndex++);
389 SendMessageW(hwndTabCtrl, WM_SETFONT, (WPARAM)pHHInfo->hFont, TRUE);
391 pHHInfo->hwndTabCtrl = hwndTabCtrl;
392 pHHInfo->pHHWinType->hwndNavigation = hWnd;
398 static void HP_GetHTMLRect(HHInfo *pHHInfo, RECT *rc)
400 HWND hwndParent = pHHInfo->pHHWinType->hwndHelp;
401 HWND hwndToolbar = pHHInfo->pHHWinType->hwndToolBar;
402 HWND hwndNavigation = pHHInfo->pHHWinType->hwndNavigation;
403 RECT rectTB, rectWND, rectNP;
405 GetClientRect(hwndParent, &rectWND);
406 GetClientRect(hwndToolbar, &rectTB);
407 GetClientRect(hwndNavigation, &rectNP);
409 rc->left = rectNP.right;
410 rc->top = rectTB.bottom;
411 rc->right = rectWND.right - rectNP.right;
412 rc->bottom = rectWND.bottom - rectTB.bottom;
415 static BOOL HH_AddHTMLPane(HHInfo *pHHInfo)
418 HWND hwndParent = pHHInfo->pHHWinType->hwndHelp;
419 DWORD dwStyles = WS_CHILDWINDOW | WS_VISIBLE | WS_CLIPCHILDREN;
420 DWORD dwExStyles = WS_EX_LEFT | WS_EX_LTRREADING | WS_EX_RIGHTSCROLLBAR | WS_EX_CLIENTEDGE;
423 HP_GetHTMLRect(pHHInfo, &rc);
425 hWnd = CreateWindowExW(dwExStyles, szChildClass, szEmpty, dwStyles,
426 rc.left, rc.top, rc.right, rc.bottom,
427 hwndParent, NULL, pHHInfo->hInstance, NULL);
431 if (!WB_EmbedBrowser(pHHInfo->pWBInfo, hWnd))
434 /* store the pointer to the HH info struct */
435 SetWindowLongPtrW(hWnd, GWLP_USERDATA, (LONG_PTR)pHHInfo);
437 ShowWindow(hWnd, SW_SHOW);
440 pHHInfo->pHHWinType->hwndHTML = hWnd;
446 static void Help_OnSize(HWND hWnd, LPARAM lParam)
448 HHInfo *pHHInfo = (HHInfo *)GetWindowLongPtrW(hWnd, GWLP_USERDATA);
454 /* Only resize the Navigation pane vertically */
457 NP_GetNavigationRect(pHHInfo, &rc);
458 SetWindowPos(pHHInfo->pHHWinType->hwndNavigation, HWND_TOP, 0, 0,
459 rc.right, rc.bottom, SWP_NOMOVE);
461 GetClientRect(pHHInfo->pHHWinType->hwndNavigation, &rc);
462 SetWindowPos(pHHInfo->hwndTabCtrl, HWND_TOP, 0, 0,
463 rc.right - TAB_RIGHT_PADDING,
464 rc.bottom - TAB_TOP_PADDING, SWP_NOMOVE);
467 HP_GetHTMLRect(pHHInfo, &rc);
468 SetWindowPos(pHHInfo->pHHWinType->hwndHTML, HWND_TOP, 0, 0,
469 LOWORD(lParam), HIWORD(lParam), SWP_NOMOVE);
472 LRESULT CALLBACK Help_WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
480 if (HIWORD(wParam) == BN_CLICKED)
481 TB_OnClick(hWnd, LOWORD(wParam));
484 Help_OnSize(hWnd, lParam);
487 hdc = BeginPaint(hWnd, &ps);
495 return DefWindowProcW(hWnd, message, wParam, lParam);
501 static BOOL HH_CreateHelpWindow(HHInfo *pHHInfo)
504 HINSTANCE hInstance = pHHInfo->hInstance;
505 RECT winPos = pHHInfo->pHHWinType->rcWindowPos;
507 DWORD dwStyles, dwExStyles;
508 DWORD x, y, width, height;
510 static const WCHAR windowClassW[] = {
511 'H','H',' ', 'P','a','r','e','n','t',0
514 wcex.cbSize = sizeof(WNDCLASSEXW);
515 wcex.style = CS_HREDRAW | CS_VREDRAW;
516 wcex.lpfnWndProc = (WNDPROC)Help_WndProc;
519 wcex.hInstance = hInstance;
520 wcex.hIcon = LoadIconW(NULL, (LPCWSTR)IDI_APPLICATION);
521 wcex.hCursor = LoadCursorW(NULL, (LPCWSTR)IDC_ARROW);
522 wcex.hbrBackground = (HBRUSH)(COLOR_MENU + 1);
523 wcex.lpszMenuName = NULL;
524 wcex.lpszClassName = windowClassW;
525 wcex.hIconSm = LoadIconW(NULL, (LPCWSTR)IDI_APPLICATION);
527 RegisterClassExW(&wcex);
529 /* Read in window parameters if available */
530 if (pHHInfo->pHHWinType->fsValidMembers & HHWIN_PARAM_STYLES)
531 dwStyles = pHHInfo->pHHWinType->dwStyles;
533 dwStyles = WS_OVERLAPPEDWINDOW | WS_VISIBLE |
534 WS_CLIPSIBLINGS | WS_CLIPCHILDREN;
536 if (pHHInfo->pHHWinType->fsValidMembers & HHWIN_PARAM_EXSTYLES)
537 dwExStyles = pHHInfo->pHHWinType->dwExStyles;
539 dwExStyles = WS_EX_LEFT | WS_EX_LTRREADING | WS_EX_APPWINDOW |
540 WS_EX_WINDOWEDGE | WS_EX_RIGHTSCROLLBAR;
542 if (pHHInfo->pHHWinType->fsValidMembers & HHWIN_PARAM_RECT)
546 width = winPos.right - x;
547 height = winPos.bottom - y;
551 x = WINTYPE_DEFAULT_X;
552 y = WINTYPE_DEFAULT_Y;
553 width = WINTYPE_DEFAULT_WIDTH;
554 height = WINTYPE_DEFAULT_HEIGHT;
557 hWnd = CreateWindowExW(dwExStyles, windowClassW, pHHInfo->pHHWinType->pszCaption,
558 dwStyles, x, y, width, height, NULL, NULL, hInstance, NULL);
562 ShowWindow(hWnd, SW_SHOW);
565 /* store the pointer to the HH info struct */
566 SetWindowLongPtrW(hWnd, GWLP_USERDATA, (LONG_PTR)pHHInfo);
568 pHHInfo->pHHWinType->hwndHelp = hWnd;
572 static void HH_CreateFont(HHInfo *pHHInfo)
576 GetObjectW(GetStockObject(ANSI_VAR_FONT), sizeof(LOGFONTW), &lf);
577 lf.lfWeight = FW_NORMAL;
579 lf.lfUnderline = FALSE;
581 pHHInfo->hFont = CreateFontIndirectW(&lf);
584 static void HH_InitRequiredControls(DWORD dwControls)
586 INITCOMMONCONTROLSEX icex;
588 icex.dwSize = sizeof(INITCOMMONCONTROLSEX);
589 icex.dwICC = dwControls;
590 InitCommonControlsEx(&icex);
593 /* Creates the whole package */
594 static BOOL HH_CreateViewer(HHInfo *pHHInfo)
596 HH_CreateFont(pHHInfo);
598 if (!HH_CreateHelpWindow(pHHInfo))
601 HH_InitRequiredControls(ICC_BAR_CLASSES);
603 if (!HH_AddToolbar(pHHInfo))
606 HH_RegisterChildWndClass(pHHInfo);
608 if (!HH_AddNavigationPane(pHHInfo))
611 if (!HH_AddHTMLPane(pHHInfo))
617 static HHInfo *HH_OpenHH(HINSTANCE hInstance, LPWSTR szCmdLine)
619 HHInfo *pHHInfo = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(HHInfo));
621 pHHInfo->pHHWinType = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(HH_WINTYPEW));
622 pHHInfo->pCHMInfo = HeapAlloc(GetProcessHeap(), 0, sizeof(CHMInfo));
623 pHHInfo->pWBInfo = HeapAlloc(GetProcessHeap(), 0, sizeof(WBInfo));
624 pHHInfo->hInstance = hInstance;
625 pHHInfo->szCmdLine = szCmdLine;
630 static void HH_Close(HHInfo *pHHInfo)
635 /* Free allocated strings */
636 if (pHHInfo->pHHWinType)
638 HeapFree(GetProcessHeap(), 0, (LPWSTR)pHHInfo->pHHWinType->pszType);
639 HeapFree(GetProcessHeap(), 0, (LPWSTR)pHHInfo->pHHWinType->pszCaption);
640 HeapFree(GetProcessHeap(), 0, (LPWSTR)pHHInfo->pHHWinType->pszToc);
641 HeapFree(GetProcessHeap(), 0, (LPWSTR)pHHInfo->pHHWinType->pszType);
642 HeapFree(GetProcessHeap(), 0, (LPWSTR)pHHInfo->pHHWinType->pszIndex);
643 HeapFree(GetProcessHeap(), 0, (LPWSTR)pHHInfo->pHHWinType->pszFile);
644 HeapFree(GetProcessHeap(), 0, (LPWSTR)pHHInfo->pHHWinType->pszHome);
645 HeapFree(GetProcessHeap(), 0, (LPWSTR)pHHInfo->pHHWinType->pszJump1);
646 HeapFree(GetProcessHeap(), 0, (LPWSTR)pHHInfo->pHHWinType->pszJump2);
647 HeapFree(GetProcessHeap(), 0, (LPWSTR)pHHInfo->pHHWinType->pszUrlJump1);
648 HeapFree(GetProcessHeap(), 0, (LPWSTR)pHHInfo->pHHWinType->pszUrlJump2);
651 HeapFree(GetProcessHeap(), 0, pHHInfo->pHHWinType);
652 HeapFree(GetProcessHeap(), 0, pHHInfo->szCmdLine);
654 if (pHHInfo->pCHMInfo)
656 CHM_CloseCHM(pHHInfo->pCHMInfo);
657 HeapFree(GetProcessHeap(), 0, pHHInfo->pCHMInfo);
660 if (pHHInfo->pWBInfo)
662 WB_UnEmbedBrowser(pHHInfo->pWBInfo);
663 HeapFree(GetProcessHeap(), 0, pHHInfo->pWBInfo);
667 static void HH_OpenDefaultTopic(HHInfo *pHHInfo)
670 LPCWSTR defTopic = pHHInfo->pHHWinType->pszFile;
672 CHM_CreateITSUrl(pHHInfo->pCHMInfo, defTopic, url);
673 WB_Navigate(pHHInfo->pWBInfo, url);
676 static BOOL HH_OpenCHM(HHInfo *pHHInfo)
678 if (!CHM_OpenCHM(pHHInfo->pCHMInfo, pHHInfo->szCmdLine))
681 if (!CHM_LoadWinTypeFromCHM(pHHInfo->pCHMInfo, pHHInfo->pHHWinType))
687 /* FIXME: Check szCmdLine for bad arguments */
688 int WINAPI doWinMain(HINSTANCE hInstance, LPSTR szCmdLine)
693 if (OleInitialize(NULL) != S_OK)
696 pHHInfo = HH_OpenHH(hInstance, HH_ANSIToUnicode(szCmdLine));
697 if (!pHHInfo || !HH_OpenCHM(pHHInfo) || !HH_CreateViewer(pHHInfo))
703 HH_OpenDefaultTopic(pHHInfo);
705 while (GetMessageW(&msg, 0, 0, 0))
707 TranslateMessage(&msg);
708 DispatchMessageW(&msg);
712 HeapFree(GetProcessHeap(), 0, pHHInfo);