Commit e0b952b4 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

hhctrl.ocx: Move doWinMain to hhctrl.c.

parent 1a2456cc
...@@ -57,7 +57,7 @@ static LPWSTR HH_LoadString(DWORD dwID) ...@@ -57,7 +57,7 @@ static LPWSTR HH_LoadString(DWORD dwID)
return string; 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 buf[INTERNET_MAX_URL_LENGTH];
WCHAR full_path[MAX_PATH]; WCHAR full_path[MAX_PATH];
...@@ -764,7 +764,7 @@ static BOOL CreateViewer(HHInfo *pHHInfo) ...@@ -764,7 +764,7 @@ static BOOL CreateViewer(HHInfo *pHHInfo)
return TRUE; return TRUE;
} }
static void ReleaseHelpViewer(HHInfo *info) void ReleaseHelpViewer(HHInfo *info)
{ {
if (!info) if (!info)
return; return;
...@@ -790,7 +790,7 @@ static void ReleaseHelpViewer(HHInfo *info) ...@@ -790,7 +790,7 @@ static void ReleaseHelpViewer(HHInfo *info)
OleUninitialize(); OleUninitialize();
} }
static HHInfo *CreateHelpViewer(LPCWSTR filename) HHInfo *CreateHelpViewer(LPCWSTR filename)
{ {
HHInfo *info = hhctrl_alloc_zero(sizeof(HHInfo)); HHInfo *info = hhctrl_alloc_zero(sizeof(HHInfo));
...@@ -814,28 +814,3 @@ static HHInfo *CreateHelpViewer(LPCWSTR filename) ...@@ -814,28 +814,3 @@ static HHInfo *CreateHelpViewer(LPCWSTR filename)
return info; 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;
}
...@@ -135,3 +135,31 @@ HWND WINAPI HtmlHelpA(HWND caller, LPCSTR filename, UINT command, DWORD data) ...@@ -135,3 +135,31 @@ HWND WINAPI HtmlHelpA(HWND caller, LPCSTR filename, UINT command, DWORD data)
hhctrl_free(wfile); hhctrl_free(wfile);
return result; 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;
}
...@@ -80,6 +80,10 @@ CHMInfo *OpenCHM(LPCWSTR szFile); ...@@ -80,6 +80,10 @@ CHMInfo *OpenCHM(LPCWSTR szFile);
BOOL LoadWinTypeFromCHM(CHMInfo *pCHMInfo, HH_WINTYPEW *pHHWinType); BOOL LoadWinTypeFromCHM(CHMInfo *pCHMInfo, HH_WINTYPEW *pHHWinType);
CHMInfo *CloseCHM(CHMInfo *pCHMInfo); CHMInfo *CloseCHM(CHMInfo *pCHMInfo);
HHInfo *CreateHelpViewer(LPCWSTR);
void ReleaseHelpViewer(HHInfo*);
BOOL NavigateToChm(HHInfo*,LPCWSTR,LPCWSTR);
/* memory allocation functions */ /* memory allocation functions */
static inline void *hhctrl_alloc(size_t len) static inline void *hhctrl_alloc(size_t len)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment