-
Notifications
You must be signed in to change notification settings - Fork 0
/
help.cpp
36 lines (28 loc) · 900 Bytes
/
help.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#include "stdafx.h"
#include "util.h"
#include "help.h"
#include "resource.h"
bool Help::init(HINSTANCE inst, const std::wstring& fname)
{
hlpFile = L"";
std::wstring path = ef::dirSpec(ef::Win::getModulePath(inst));
if (path.empty())
return false;
#if defined(DEBUG) || defined(_DEBUG)
path += L"..\\help\\";
#endif
hlpFile = path + fname;
return true;
}
// if 'topic' is empty, use just the filename (goes to default topic)
// otherwise, append it to file spec
// topic format is: "::\someTopic.html" or
// "::\someTopic.html#namedAnchor"
HWND Help::show(HWND wnd, const std::wstring& topic)
{
if (hlpFile.empty()) {
Util::App::error(wnd, Util::Res::ResStr(IDS_ERR_HELPMISSING));
return 0;
}
return ef::Win::HTMLHelp::obj().dispTopic(wnd, (hlpFile + topic).c_str());
}