hhctrl.ocx: Move doWinMain to hhctrl.c.

This commit is contained in:
Jacek Caban 2007-02-28 03:49:20 +01:00 committed by Alexandre Julliard
parent 1a2456cc4c
commit e0b952b436
3 changed files with 35 additions and 28 deletions

View File

@ -57,7 +57,7 @@ static LPWSTR HH_LoadString(DWORD dwID)
return string;
}
static BOOL NavigateToChm(HHInfo *info, LPCWSTR file, LPCWSTR index)
BOOL NavigateToChm(HHInfo *info, LPCWSTR file, LPCWSTR index)
{
WCHAR buf[INTERNET_MAX_URL_LENGTH];
WCHAR full_path[MAX_PATH];
@ -764,7 +764,7 @@ static BOOL CreateViewer(HHInfo *pHHInfo)
return TRUE;
}
static void ReleaseHelpViewer(HHInfo *info)
void ReleaseHelpViewer(HHInfo *info)
{
if (!info)
return;
@ -790,7 +790,7 @@ static void ReleaseHelpViewer(HHInfo *info)
OleUninitialize();
}
static HHInfo *CreateHelpViewer(LPCWSTR filename)
HHInfo *CreateHelpViewer(LPCWSTR filename)
{
HHInfo *info = hhctrl_alloc_zero(sizeof(HHInfo));
@ -814,28 +814,3 @@ static HHInfo *CreateHelpViewer(LPCWSTR filename)
return info;
}
/* FIXME: Check szCmdLine for bad arguments */
int WINAPI doWinMain(HINSTANCE hInstance, LPSTR szCmdLine)
{
MSG msg;
HHInfo *info;
LPWSTR filename = strdupAtoW(szCmdLine);
info = CreateHelpViewer(filename);
hhctrl_free(filename);
if(!info)
return -1;
NavigateToChm(info, info->pCHMInfo->szFile, info->WinType.pszFile);
while (GetMessageW(&msg, 0, 0, 0))
{
TranslateMessage(&msg);
DispatchMessageW(&msg);
}
ReleaseHelpViewer(info);
return 0;
}

View File

@ -135,3 +135,31 @@ HWND WINAPI HtmlHelpA(HWND caller, LPCSTR filename, UINT command, DWORD data)
hhctrl_free(wfile);
return result;
}
/******************************************************************
* doWinMain (hhctrl.ocx.13)
*/
int WINAPI doWinMain(HINSTANCE hInstance, LPSTR szCmdLine)
{
MSG msg;
HHInfo *info;
LPWSTR filename = strdupAtoW(szCmdLine);
/* FIXME: Check szCmdLine for bad arguments */
info = CreateHelpViewer(filename);
hhctrl_free(filename);
if(!info)
return -1;
NavigateToChm(info, info->pCHMInfo->szFile, info->WinType.pszFile);
while (GetMessageW(&msg, 0, 0, 0))
{
TranslateMessage(&msg);
DispatchMessageW(&msg);
}
ReleaseHelpViewer(info);
return 0;
}

View File

@ -80,6 +80,10 @@ CHMInfo *OpenCHM(LPCWSTR szFile);
BOOL LoadWinTypeFromCHM(CHMInfo *pCHMInfo, HH_WINTYPEW *pHHWinType);
CHMInfo *CloseCHM(CHMInfo *pCHMInfo);
HHInfo *CreateHelpViewer(LPCWSTR);
void ReleaseHelpViewer(HHInfo*);
BOOL NavigateToChm(HHInfo*,LPCWSTR,LPCWSTR);
/* memory allocation functions */
static inline void *hhctrl_alloc(size_t len)