I would like to have something directly embedded into OR.
About the example you have kindly coverted for me, i didn't know that it was base on MFC.
MFC is a NoNo for me, what i want, is a pure Win32 solution (like the one i am using in my other applications, but so far i can only display plain text without images, because OLE is missing from my code).
Here is the very short Win32 code i am using to display plain text without image.
#pragma once
#include <Richedit.h>
DWORD CALLBACK EditStreamCallback(DWORD_PTR dwCookie, LPBYTE lpBuff, LONG cb, LONG* pcb) {
HANDLE hFile = (HANDLE)dwCookie;
return !ReadFile(hFile, lpBuff, cb, (DWORD*)pcb, NULL);
}
BOOL LoadRTF(IN HWND hWnd) {
BOOL fSuccess = FALSE;
HANDLE fHandle = 0;
EDITSTREAM es = { 0 };
WCHAR szFileName[MAX_PATH] = {0};
Path_Combine(szFileName, skSkinFolder(), L"HELP.rtf");
if (FileExist(szFileName)) {
if (zFOpen(szFileName, 0, 2, fHandle) == 0) {
es.pfnCallback = EditStreamCallback;
es.dwCookie = (DWORD_PTR) fHandle;
LRESULT nRet = SendMessage(hWnd, EM_STREAMIN, SF_RTF, (LPARAM) &es);
zFClose(fHandle); fHandle = 0;
}
}
return fSuccess;
}
void MoveHelp () {
if (IsWindowVisible(gP.hHelp)) {
RECT rc = { 0 };
GetViewRect(gP.hMain, &rc);
MoveWindow(gP.hHelp, 0, 0, Width(rc), Height(rc), true);
PutFocusOn(gP.hHelp);
}
}
// Create help control
HWND CreateHelp(IN HINSTANCE hInstance) {
RECT lpr; GetViewRect(gP.hGL, &lpr);
DWORD dwStyle = WS_CHILD | WS_VSCROLL | ES_MULTILINE | ES_READONLY | WS_BORDER;
DWORD dwExStyle = 0;
//HWND hWnd = CreateWindowEx(0, L"RichEdit20A", $NULL, dwStyle, 0, 0, 0, 0, gP.hMain, (HMENU) IDC_RICHEDIT, hInstance, NULL);
HWND hWnd = CreateWindowEx(0, MSFTEDIT_CLASS, L"", dwStyle, 0, 0, Width(lpr), Height(lpr), gP.hMain, NULL, hInstance, NULL);
//HWND hWnd = CreateWindowEx(0, L"RichEdit20A", $NULL, dwStyle, 100, 0, Width(lpr), Height(lpr), gP.hMain, NULL, hInstance, NULL);
if (IsWindow(hWnd)) {
LoadRTF(hWnd);
}
return hWnd;
}
and in Main.cpp
//HMODULE hRichEdit = LoadLibrary(L"RICHED20.DLL");
HMODULE hRichEdit = LoadLibrary(L"Msftedit.dll");
if (hRichEdit) {
gP.hHelp = CreateHelp(hInstance);
if (IsWindow(gP.hHelp)) {
Path_Combine(gP.mt.FullName, skSkinFolder(), L"BTN_Help.png");
hCtrl = skButtonImage(gP.hMain, gP.mt.FullName, ClientW - 127, 664, IDC_USERHELP, 5);
skCreateToolTip(hCtrl, TipFormat(L"User help"));
}
}