I want to view the html content of an epub file. I dont have any problem reading and processing epub file. my problem is how to view the result HTML? I know I can use WebBrowser control in c#. but the problem is that webbrowser content can be read from external applications. I use my own DRM to encrypt and decrypt epub files. but I want to prevent copying book content from view.
I have this code (written in delphi) to get html document and content from ie control from any application:
function GetIEDocumentFromHWND(WHandle: HWND;
var doc: IHTMLDocument2): HRESULT;
var
hInst: HWND;
lRes: Cardinal;
MSG: Integer;
pDoc: IHTMLDocument2;
ObjectFromLresult: TObjectFromLresult;
IE: IWebbrowser2;
begin
hInst := LoadLibrary('Oleacc.dll');
@ObjectFromLresult := GetProcAddress(hInst, 'ObjectFromLresult');
if @ObjectFromLresult <> nil then begin
try
MSG := RegisterWindowMessage('WM_HTML_GETOBJECT');
SendMessageTimeOut(WHandle, MSG, 0, 0, SMTO_ABORTIFHUNG, 1000, lRes);
Result := ObjectFromLresult(lRes, IHTMLDocument2, 0, pDoc);
doc:=pDoc;
if Result = S_OK then
(pDoc.parentWindow as IServiceprovider).QueryService(IWebbrowserApp,
IWebbrowser2, IE);
finally
FreeLibrary(hInst);
end;
end;
end;
this code proves that using webbrowser control is not a good solution. then what can I do?
- is there any way to prevent other applications from controlling my webbrowser control?
- is there any alternatives for webbrowser control having same power to view html ?