can anyone suggest how to show htnl files in editbox control of the above examples so it can be made ebook.
thanks in advance
scjain
Posted on 2009-07-03 06:22:49 by scjain
I assume you mean HTML files. Showing them in an edit box will only show the HTML source code which I suspect is not what you want to do. Instead you can use a WebBrowser ATL control and render the page in that. As an example of an ATL WebBrowser control you can take a look at my Help2Viewer application, it uses one.



Attachments:
Posted on 2009-07-06 19:38:56 by donkey
Thanks a lot for an early reply.Actualy i wanted to make an executable ebook from chm or htm file. Is it possible in masm32.
scjain
Posted on 2009-07-09 08:41:00 by scjain
Sure its possible in MASM32. HTML files are self evident however CHM files are stored as Infotech archives and need to be extracted to be viewed. To extract CHM files you would use the IIT set of interfaces. I am currently working (very slowly) on a set of routines for extracting HTML files from IIT (CHM) files. Here are a few (in GoAsm format)

OpenCHM FRAME pwszChmFile, ppITSStore, ppStorage
// Opens a CHM file and returns a pointer to an IITStorage and IStorage interface
mov eax,
mov edx,
test edx,edx
jz >
push eax
CoInvoke(edx,IStorage.IUnknown.Release)
pop eax
mov D,0
:
mov eax,
mov edx,
test edx,edx
jz >
push eax
CoInvoke(edx,IITStorage.IUnknown.Release)
pop eax
mov D,0
:

invoke CoCreateInstance,offset CLSID_MSITStore, NULL, CLSCTX_ALL,offset IID_IITStorage,
test eax,eax
jnz >>.NOINTERFACE
CoInvoke(pMITSStore,IITStorage.StgOpenStorage,,0,STGM_READ,0,0,)
test eax,eax
jnz >>.NOSTGINTERFACE

RET
.NOSTGINTERFACE
mov eax,
mov edx,
CoInvoke(edx,IStorage.IUnknown.Release)
.NOINTERFACE
mov eax,-1
ret
ENDF


EnumerateCHMStreams FRAME pStorage, Type, pCallback, lParam
LOCAL cCount:D
LOCAL pIEnum :D
LOCAL poutSTATSTG:D
LOCAL cFetched:D

// Function : EnumerateCHMStreams
// Parameters :
// pStorage = pointer to an IITStorage interface
// Type = the type of item that should be enumerated
// pCallback = pointer to an callback function
// lParam = application defined value passed to the callback

// Enumerates the streams in the file and passes a pointer to
// an STATSTG structure to an application defined callback
// The enumeration handles freeing the memory allocated by the
// enumeration object
// The callback routine should return TRUE to continue the enumeration
// or FALSE to stop it

// Reset the counter
mov D,1

// Check for invalid pointers
cmp D,0
je >>.NOINTERFACE
cmp D,0
je >>.NOINTERFACE

// Get an enumeration interface pointer
CoInvoke(pStorage,IStorage.EnumElements,0,0,0,offset pIEnum)
cmp D,0
je >>.NOINTERFACE
test eax,eax
jnz >>.NOINTERFACE
// Walk through the enumeration
:
CoInvoke(pIEnum,IEnumSTATSTG.Next,1,offset pSTATSTG,offset cFetched)
cmp D,0
jz >.ENDENUM
// Check to see if the type matches
mov eax,offset pSTATSTG
mov eax,
cmp D,0
je >.CALLENUM
and eax,
test eax,eax
jz >.NOCALLBACK

.CALLENUM
// pass the data to the callback
invoke ,,offset pSTATSTG,
// push the return result from the callback
push eax
// Free the task memory allocated by the enumeration
mov eax,
mov eax,
invoke CoTaskMemFree,eax
pop eax
test eax,eax
jz >.ENDENUM
.NOCALLBACK
inc D
jmp <<

.ENDENUM
CoInvoke(pIEnum,IEnumSTATSTG.Reset)
CoInvoke(pIEnum,IEnumSTATSTG.IUnknown.Release)
xor eax,eax
RET

.NOINTERFACE
mov eax,-1
RET
ENDF


ReadStream FRAME pStorage, pMemory, pwszStreamName, pcbCopied
LOCAL pStream:D

// Reads a stream into the memory buffer supplied
// the size of the buffer must be in the location pointed
// to by pcbCopied. Returns the number of bytes read in the
// location pointed to by pcbCopied

CoInvoke(pStorage,IStorage.OpenStream,,0,STGM_SHARE_EXCLUSIVE,0,offset pStream)
test eax,eax
jnz >>.NOINTERFACE
cmp D,0
je >>.NOINTERFACE
mov eax,
mov eax,
test eax,eax
jz >>.NOINTERFACE

CoInvoke(pStream,IStream.Read,,eax,)

CoInvoke(pStream,IStream.IUnknown.Release)
xor eax,eax
RET

.NOINTERFACE
mov eax,-1
RET
ENDF


In order to use the functions above you would call them as follows:

invoke OpenCHM,L"C:\Programming\RadASM\GoAsm\Projects\HTMLHelp\htmlhelp.chm",offset pMITSStore,offset pstgOpen
test eax,eax
js >>.EXITPROGGY

CoInvoke(pMITSStore,IITStorage.IUnknown.QueryInterface,offset IID_IITWordWheel,offset pXMLNode)

invoke EnumerateCHMStreams,,ENUM_STGTY_ALL,offset EnumerationCallback, 0
invoke GlobalAlloc,GMEM_FIXED,32768
mov ,eax

mov D,32768
invoke ReadStream,,,"HTMLHelp.hhk",offset cbRead


In order to use these functions you would have to either write your own header file for MASM32 or you could use GoAsm and use the headers from the header project. The following headers are the relevant ones:

htmlhelp.h
itss.h
infotech.h

Donkey
Posted on 2009-07-13 22:58:51 by donkey
I think he just wants to compile a CHM from HTML source.
There's a tool for that! Been so long since I looked at it, I can't recall its name.
Posted on 2009-07-14 02:26:03 by Homer
Microsofts HTML Help workshop does that.
Posted on 2009-07-14 06:42:33 by donkey