}
/**
- * @brief Load heksedit.dll and setup window class name
+ * @brief returns true if heksedit.dll is loadable
*/
-BOOL CHexMergeView::PreCreateWindow(CREATESTRUCT& cs)
+bool CHexMergeView::IsLoadable()
{
static void *pv = NULL;
if (pv == NULL)
if (FAILED(::CoGetClassObject(clsid, CLSCTX_INPROC_SERVER, NULL, IID_IUnknown, &pv)))
{
pv = LoadLibrary(_T("Frhed\\hekseditU.dll"));
- if (!pv)
- LangMessageBox(IDS_FRHED_NOTINSTALLED, MB_OK);
}
}
+ return pv != nullptr;
+}
+
+/**
+ * @brief Load heksedit.dll and setup window class name
+ */
+BOOL CHexMergeView::PreCreateWindow(CREATESTRUCT& cs)
+{
+ if (!IsLoadable())
+ LangMessageBox(IDS_FRHED_NOTINSTALLED, MB_OK);
cs.lpszClass = _T("heksedit");
cs.style |= WS_HSCROLL | WS_VSCROLL;
return TRUE;
void ZoomText(int amount);
static void CopySel(const CHexMergeView *src, CHexMergeView *dst);
static void CopyAll(const CHexMergeView *src, CHexMergeView *dst);
+ static bool IsLoadable();
// Overrides
protected:
virtual void OnDraw(CDC*);
m_pDirDoc = NULL;
}
- HMODULE hModule = GetModuleHandle(_T("WinIMergeLib.dll"));
+ HMODULE hModule = GetModuleHandleW(L"WinIMergeLib.dll");
if (hModule)
{
bool (*WinIMerge_DestroyWindow)(IImgMergeWindow *) =
}
/**
+ * @brief returns true if WinIMergeLib.dll is loadable
+ */
+bool CImgMergeFrame::IsLoadable()
+{
+ static HMODULE hModule;
+ if (!hModule)
+ {
+ hModule = LoadLibraryW(L"WinIMerge\\WinIMergeLib.dll");
+ if (!hModule)
+ return false;
+ }
+ return true;
+}
+
+/**
* @brief Create the splitter, the filename bar, the status bar, and the two views
*/
BOOL CImgMergeFrame::OnCreateClient( LPCREATESTRUCT /*lpcs*/,
CCreateContext* pContext)
{
- HMODULE hModule = LoadLibraryW(L"WinIMerge\\WinIMergeLib.dll");
+ if (!IsLoadable())
+ return FALSE;
+
+ HMODULE hModule = GetModuleHandleW(L"WinIMergeLib.dll");
if (!hModule)
return FALSE;
bool IsFileChangedOnDisk(int pane) const;
void CheckFileChanged(void);
String GetDescription(int pane) const { return m_strDesc[pane]; }
+ static bool IsLoadable();
// Attributes
protected:
#include "MergeDoc.h"
#include "MergeEditView.h"
#include "HexMergeDoc.h"
+#include "HexMergeView.h"
#include "ImgMergeFrm.h"
#include "LineFiltersList.h"
#include "ConflictFileParser.h"
filterBin.SetMask(GetOptionsMgr()->GetString(OPT_CMP_BIN_FILEPATTERNS));
for (pane = 0; pane < nFiles; ++pane)
{
- if (filterImg.includeFile(ifileloc[pane].filepath))
+ if (filterImg.includeFile(ifileloc[pane].filepath) && CImgMergeFrame::IsLoadable())
return ShowImgMergeDoc(pDirDoc, nFiles, ifileloc, dwFlags, strDesc, sReportFile, infoUnpacker);
- else if (filterBin.includeFile(ifileloc[pane].filepath))
+ else if (filterBin.includeFile(ifileloc[pane].filepath) && CHexMergeView::IsLoadable())
return ShowHexMergeDoc(pDirDoc, nFiles, ifileloc, dwFlags, strDesc, sReportFile, infoUnpacker);
}
return ShowMergeDoc(pDirDoc, nFiles, ifileloc, dwFlags, strDesc, sReportFile, infoUnpacker);
\r
TEST(ImageCompareTest, Open)\r
{\r
+ if (!CImgMergeFrame::IsLoadable())\r
+ return;\r
+\r
String projectRoot = getProjectRoot();\r
PathContext files = {\r
paths::ConcatPath(projectRoot, L"Src/res/right_to_middle.bmp"),\r
\r
pFrame->PostMessage(WM_CLOSE);\r
dlg.SetFormerResult(nPrevFormerResult);\r
-\r
}\r
\r
#endif
\ No newline at end of file
--- /dev/null
+**/*.txt -text\r
msgstr ""
"Project-Id-Version: WinMerge\n"
"Report-Msgid-Bugs-To: http://bugs.winmerge.org/\n"
-"POT-Creation-Date: 2018-06-03 10:30+0000\n"
+"POT-Creation-Date: 2018-06-17 03:35+0000\n"
"PO-Revision-Date: \n"
"Last-Translator: \n"
"Language-Team: English <winmerge-translate@lists.sourceforge.net>\n"