News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests

Main Menu

HTML to RTF

Started by guga, June 08, 2013, 01:56:26 PM

Previous topic - Next topic

jj2007

Quote from: ToutEnMasm on June 12, 2013, 07:12:04 PM

Quote
rename C:\Windows\System32\html.iec
No need to rename

invoke LoadLibrary,TXT("C:\windows\system32\html.iec")

works

Of course it works, debug my code and Olly will show you LoadLibrary :P

I told you to rename it because you can't rename it - access denied. That file is too important for Windows...

TouEnMasm


Perhaps a more up to date version,the one you posted had 16 bits code (strange)
http://msdn.microsoft.com/en-us/library/office/dd300649(v=office.12).aspx
Fa is a musical note to play with CL

TouEnMasm


At this instant seems there is only the clipboard viewer and the script who can translate html to rtf (I don't count the run of any office or free office).
More sample ?
Fa is a musical note to play with CL

jj2007

Quote from: ToutEnMasm on June 12, 2013, 11:40:06 PM
Perhaps a more up to date version,the one you posted had 16 bits code (strange)

The one I posted in reply #25 has definitely no 16 bits code. Unless your browser does strange things to you ::)

Quote from: ToutEnMasm on June 13, 2013, 12:03:49 AM
At this instant seems there is only the clipboard viewer and the script who can translate html to rtf

There is no clipboard viewer in Win7*), and I doubt that the XP clipboard viewer is able to do the translation (but I will check tonight). Re "script", my code is not a script (and it's the only "sample" that is working so far, unless you are hiding something from us).

*) Microsoft recommends "How To View & Manage Clipboard In Windows 7 & Vista":

QuoteClipboard in Windows 7 | 8

In Windows XP this file was situated in C:\Windows\System32\clipbrd.exe. It is now missing as a part of the Windows 7 | 8 installation. You can try to copy it from a Windows XP installation, if you have access to it, and paste it in your System32 folder. In most cases this is known to work.
Clipboard Viewer

If you wish, you can download Windows Clipboard Viewer from here. But if it does not work or if you are confronted with a message of sorts : Entry Point Not Found, then you may try to run it in Windows XP/SP2 compatibility mode and see if it works.

That is great professional advice, Microsoft :t
Unfortunately, it doesn't display HTML or RTF formats, let alone convert them :(

TouEnMasm


I was talking about the GC1039 (winword converter) who show 16 bits and 32 bits documentation (SDK.DOC and SDK32.doc).
About it i had just find a sample who failed to convert a html to rtf (without office or same things)
Fa is a musical note to play with CL

jj2007

Quote from: ToutEnMasm on June 13, 2013, 01:19:49 AM
I was talking about the GC1039 (winword converter) who show 16 bits and 32 bits documentation (SDK.DOC and SDK32.doc).

Oh sorry, I thought you were talking to me. Apologies.

guga

A couple of things about those functions:

1) Function GetReadNames seems to be completelly useless. I can´t make this stupidity to work on WinXPand all it does it check on the register for theconvertersavailable and supposedly register a new one (HTML.iec with only HTML data to be converted - no RTF, doc, Lotus etc etc). The documentation itself says to choose to use FRegisterConverter insetad....but...
All function FRegisterConverter is to create a new key on the register to insert the path, name and extension for the HTMLdata. So, for this to work weneed to do something like:


call EnumSubKeys esi, &HKEY_LOCAL_MACHINE, {B$ "SOFTWARE\Microsoft\Shared Tools\Text Converters\Import\Lotus123", 0}
call 'html.iec.FRegisterConverter' D$esi ; this create a newkey for each subkey. EX: on Lotus123 it will create a IMport/ExportSubkeys to HTML.iec
_________________________________________

Proc EnumSubKeys:
    Arguments @phKey, @dwKey, @szSubKey
    Local @cSubKeys
    Uses ebx, ecx, edx, esi

    mov esi D@phKey
    mov D$esi 0
    call 'advapi32.RegOpenKeyExA' &HKEY_LOCAL_MACHINE, D@szSubKey, 0, &KEY_ALL_ACCESS, esi
    ..If eax = &ERROR_SUCCESS
        mov D@cSubKeys 0
        lea ebx D@cSubKeys
        call 'advapi32.RegQueryInfoKeyA' D$esi, &NULL, &NULL, &NULL, ebx, &NULL, &NULL,
                                         &NULL, &NULL, &NULL, &NULL, &NULL
        If eax = &ERROR_SUCCESS
            mov eax D$ebx
        Else
            xor eax eax
        End_If
    ..Else
        xor eax eax
    ..End_If

EndP



This will create a key with the following specifications
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Shared Tools\Text Converters\Import\HTML\Text Converters]

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Shared Tools\Text Converters\Import\HTML\Text Converters\Export]

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Shared Tools\Text Converters\Import\HTML\Text Converters\Export\HTML]
"Extensions"="htm html htx"
"Name"=""
"Path"="C:\\temp\\HTML.iec"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Shared Tools\Text Converters\Import\HTML\Text Converters\Import]

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Shared Tools\Text Converters\Import\HTML\Text Converters\Import\HTML]
"Extensions"="htm html htx otm"
"Name"=""
"Path"="C:\\temp\\HTML.iec"


If path is  {B$ "SOFTWARE\Microsoft\Shared Tools\Text Converters\Import\Lotus123", 0} will use Lotus123 to save the new key
If Path is  {B$ "SOFTWARE\Microsoft\Shared Tools\Text Converters\Import\Word12", 0} will use Word12 to save the new key
etc
If we set  {B$ "SOFTWARE\Microsoft\Shared Tools\", 0} will use create the HTML.iec path as the new import/export converter to be used with. The problem is, it will overwritte any other converters with the same name.For instance i had on the converter path html32.cnv, that was saved onto the register. After applying the FRegisterConverter it replaces the html32.cnv with html.iec (which seems to be the same btw), except for the file versions
html.iec = 2018.0.0.23486
html32.cnv= 2003.1100.8165.0
both are: Microsoft HTML Converter, but html.iec is the newer one.

So, get FRegisterConverter and GetNames seems to be useless, because all they do is get the path for the converters, that can be used on a OpenDialog,for example to display a list of possible imports/exports extensions.

The only point of interest on this function is that it register newformats to be imported or exported for use with images inside html, by creting the KEys:
MSWORD
WINWORD
MSPUB
MSWORKS
WORDPAD
FRONTPG

So, if the register contains this keys, it will create the subkeys (text convert) as:
SOFTWARE\Microsoft\Shared Tools\Text Converters\Import\MSWORD\Text Converters\Import\

Which means that "MSWORD", "WINWORD" etc are the module names for this converter to work properly
Those are responsable for determining the type of Codepage for the exported/imported html files. he codePage that seems available are:
CP_UTF8
CP_950
CP_932
CP_949
CP_936

So, thinking on that we may add registry entries for MSWORD", "WINWORD etc and simply use them as paths for the InitConverter32 function choose which CodePagewill be outputed on html.iec.
For example, even if i don´t have winword installed, i can still usehtml.iec to produce a html from a RTF similar (if not equal) as if i had winword,simply adding a keyword on the registry such as:
SOFTWARE\Microsoft\Shared Tools\Text Converters\Import\MSWORD
and setting the values for path, name and description accordly.

2) Also since getreadnames are a pain to use and not work as expected and FRegisterConverter is not suitable if we already have other converters o the registry we can replace them with:


Proc GetReadNames::
    Arguments @haszClass, @haszDescrip, @haszExt
    Local @hKey, @Index
    Uses esi, ecx, edx


    mov D@hKey 0
    lea esi D@hKey
    call EnumSubKeys esi, &HKEY_LOCAL_MACHINE, {B$ "SOFTWARE\Microsoft\Shared Tools\Text Converters\Import", 0}
    On eax = 0, ExitP
    mov D@Index eax
    call RegGetKeyValue D$esi, D@Index, D@haszClass, D@haszDescrip, D@haszExt

    ; close the main key before exiting
    call 'advapi32.RegCloseKey' D$esi

EndP


Proc EnumSubKeys:
    Arguments @phKey, @dwKey, @szSubKey
    Local @cSubKeys
    Uses ebx, ecx, edx, esi

    mov esi D@phKey
    mov D$esi 0
    call 'advapi32.RegOpenKeyExA' &HKEY_LOCAL_MACHINE, D@szSubKey, 0, &KEY_ALL_ACCESS, esi
    ..If eax = &ERROR_SUCCESS
        mov D@cSubKeys 0
        lea ebx D@cSubKeys
        call 'advapi32.RegQueryInfoKeyA' D$esi, &NULL, &NULL, &NULL, ebx, &NULL, &NULL,
                                         &NULL, &NULL, &NULL, &NULL, &NULL
        If eax = &ERROR_SUCCESS
            mov eax D$ebx
        Else
            xor eax eax
        End_If
    ..Else
        xor eax eax
    ..End_If

EndP



[achKey: B$ 0 #Size_Of_String]
[lngData: B$ 0 #2000]
[lngDataLen: D$ 2000]

[VALENT:
VALENT.ve_valuename: D$ SzPath
VALENT.ve_valuelen: D$ Size_Of_String
VALENT.ve_valueptr: D$ 0
VALENT.ve_type: D$ &REG_SZ

VALENT.ve_valuename2: D$ SzName
VALENT.ve_valuelen2: D$ Size_Of_String
VALENT.ve_valueptr2: D$ 0
VALENT.ve_type2: D$ &REG_SZ

VALENT.ve_valuename3: D$ SzExtensions
VALENT.ve_valuelen3: D$ Size_Of_String
VALENT.ve_valueptr3: D$ 0
VALENT.ve_type3: D$ &REG_SZ]

[SzPath: B$ "Path", 0]
[SzName: B$ "Name", 0]
[SzExtensions: B$ "Extensions", 0]

Proc RegGetKeyValue:
    Arguments @dwKey, @Index, @haszClass, @haszDescrip, @haszExt
    Local @cbName, @SubKeyLen, @lngDataLen, @NewIndex, @phKey2, @Path, @Descr, @Ext
    Uses ebx, ecx, esi, edi, edx, eax
   
    lea ebx D@cbName
    mov D$ebx 255
    mov edi D@haszClass | mov edi D$edi | mov D@Path edi
    mov edi D@haszDescrip | mov edi D$edi | mov D@Descr edi
    mov edi D@haszExt | mov edi D$edi | mov D@Ext edi
    xor esi esi
    .While esi < D@Index
   
        ; get the subkey name.Ex: HTML, Lotus123,
        call 'advapi32.RegEnumKeyExA' D@dwKey, esi, achKey, ebx, &NULL, &NULL, &NULL, &NULL
        ...If eax = &ERROR_SUCCESS
            lea edi D@phKey2
            mov D$edi 0
            call 'advapi32.RegOpenKeyExA' D@dwKey, achKey, 0, &KEY_ALL_ACCESS, edi
            ..If eax = &ERROR_SUCCESS
                ; get the values of the subkey and store them on the proper buffers
                call 'advapi32.RegQueryMultipleValuesA' D$edi, VALENT, 3, lngData, lngDataLen
                .If eax = &ERROR_SUCCESS
               
                    ; Path
                    mov edi D@Path
                    call StrCpy D$VALENT.ve_valueptr, edi
                    mov edi D@Path | add edi Size_Of_String | mov D@Path edi

                    ; Description
                    mov edi D@Descr
                    call StrCpy D$VALENT.ve_valueptr2, edi
                    mov edi D@Descr | add edi Size_Of_String | mov D@Descr edi

                    ; Extension
                    mov edi D@Ext
                    call StrCpy D$VALENT.ve_valueptr3, edi
                    mov edi D@Ext | add edi Size_Of_String | mov D@Ext edi

                    call ClearBuffer lngData, 2000
                .End_If
            ..End_If
            ; close this subkey on each loop
            call 'advapi32.RegCloseKey' D$edi

        ...End_If
        mov D$ebx Size_Of_String
        inc esi
    .End_While
EndP



The GetReadNames function can handle 160 converters and their parameters are pointers to an array of strinsg related to path,description and extension. Exampleof usage:


[Teste1: D$ SzPath]
[Teste2: D$ SzDescription]
[Teste3: D$ SzExtension]
[SzPath: B$ ? #(160*Size_Of_String)]
[SzDescription: B$ ? #(160*Size_Of_String)]
[SzExtension: B$ ? #(160*Size_Of_String)]

[Size_Of_String 255]
call GetReadNames Teste1, Teste2, Teste3
Coding in Assembly requires a mix of:
80% of brain, passion, intuition, creativity
10% of programming skills
10% of alcoholic levels in your blood.

My Code Sites:
http://rosasm.freeforums.org
http://winasm.tripod.com

guga

The RegisterApp is described as follows:



;;
    Function: RegisterApp

    Learn about calling app, and teach it about us.
    The RegisterApp API is the means by which the converter and application can negotiate details about the conversion to follow.
    The application calls the converter with a list of preferences from the application and the converter returns a list of its own preferences.
    Having both sets of preferences, both the application and the converter can deduce the correct behavior for this particular conversion.
    The lists are self-describing and may be extended in future. This mechanism is designed to be used for all new refinements to the conversions API,
    and there should consequently be no extensions to older mechanisms such as the flags in PFN_RTF or even the flags to RegisterApp.
    It is strongly recommended that all converters implement this API. However, not all legacy applications will call it.

    Arguments
   
    lFlags: A group of flags specifying options to the converter, defined below:

            NAME                    Value   Description
            REGAPP_VER              01      Specifies major and minor version of Word with which the RTF of the converter is compliant.
                                            A converter using this opcode must specify at least Word 6.0 level RTF; newer versions of Word
                                            are not guaranteed to be able to provide RTF compatible with older readers.
                                            This opcode takes two short arguments, the major and minor version numbers.
            REGAPP_DOCFILE          02      Specifies whether or not the converter can handle Word document files, and whether or not the converter
                                            can handle regular files. This opcode takes one short argument. Bit 0 indicates whether the converter
                                            accepts docfiles, bit 1 indicates whether the converter accepts non-docfiles.
            REGAPP_CHARSET          03      Specifies the character set (either ANSI or OEM) in which file names should be encoded.
                                            The default is OEM, in which case the converter must convert the OEM file names to ANSI itself,
                                            using the Win32 OemToChar function. Using this opcode to specify that the converter can handle
                                            ANSI file namesis preferable, as the conversion from ANSI to OEM and then back to ANSI is flawed,
                                            making some file names impossible to pass to a converter. This opcode takes a single byte argument
                                            which is the character set.
            REGAPP_RELOADONSAVE     04      The presence of this opcode specifies that Word should reload the document from the newly-saved file after
                                            an export conversion. This opcode takes no arguments.
            REGAPP_PICPLACEHOLD     05      The presence of this opcode specifies that Word should include placeholder pictures with size information
                                            when emitting RTF for INCLUDEPICTURE fields. This opcode takes no arguments.
            REGAPP_FAVOURUNICODE    06      The presence of this opcode specifies that Word should prefer Unicode over other character representations,
                                            such as DBCS, when emitting RTF. This opcode takes no arguments.
            REGAPP_NOCLASSIFYCHARS  07      The presence of this opcode specifies that Word should not break text runs by character set classification.
                                            This opcode takes no arguments.
            REGAPP_FILE NAME        080     Word exports documents through converters to temporary files and renames the temporary files after the
                                            conversion completes successfully. This opcode takes one variable length argument which specifies the
                                            final filename to which Word will rename the finished conversion. The filename is not '\0'-terminated.
                                            Its length is inferred from the opcode's cbSize field. This filename is always in the ANSI character set.
            REGAPP_INTERIMPATH      081     The presence of this opcode indicates that Word will move the file after the export operation completes;
                                            for example to an FTP server. This opcode takes no arguments.

            RegisterApp still supports the flags passed from the application to the converter in its first argument.
            This is why the function was originally provided. The aditional equates below can be used in combination with the above ones.

            NAME                        Value   Bit     Description
            REGAPP_FREGAPPPCTCOMP        01     0       The application sets this flag if it is prepared to accept percent complete numbers from the
                                                        converter on RtfToForeign32 calls. When this bit is set, the application is required to pass
                                                        a valid handle to a PCVT structure inside the ghBuff buffer on the RtfToForeign32 call.
                                                        The setting of this bit does not require that the converter provide percent complete numbers but
                                                        it can if you like.
            REGAPP_FREGAPPNOBINARY      02      1       This flag is set if the application is not prepared to deal with binary data in the RTF stream
                                                        from the converter. If this flag is set, the converter will provide all picture data in hexadecimal
                                                        form rather than binary. Because some older RTF readers do not correctly handle binary data,
                                                        this flag is assumed set if RegisterApp is not called.
            REGAPP_FREGAPPPREVIEW       04      2       This flag is set if the converter is being called in a preview mode (such as the Find preview in Word).
                                                        The converter can respond to this setting by not displaying dialog boxes, using default responses,
                                                        and taking other actions to enhance performance when previewing a document.
            REGAPP_FREGAPPSUPPORTNONOEM 08      3       If this flag is set, the application is prepared to provide non-OEM (that is, ANSI) file names.
                                                        If this flag is set by the application and the converter provides the Charset opcode with an ANSI
                                                        argument in its preferences list, then it is understood by both the application and the converter
                                                        that file names will be passed in ANSI.
            REGAPP_FREGAPPINDEXING      16      4       This flag is set to indicate that the calling application is only indexing textual content,
                                                        and does not need layout and other information. When this flag is set, the converter can omit most
                                                        RTF to significantly speed up the conversion.
            REGAPP_UNUSED                       5-31    Available for future use. Must be set to 0.

    lpFuture: A pointer to a list of application preferences. May be NULL, indicating there are no application preferences.
   
    Returns:
        handle to a GlobalAlloc'd RegAppRet structure.  Caller must use GlobalLock() to access it, and MUST free it if the return value is non-NULL.

    Remarks:

        The converter will return an HGLOBAL handle to a GlobalAlloc-retrieved list of its own preferences. The converter can return NULL
        if it has no preferences. The calling application must use GlobalFree on this list of converter preferences if non-NULL to avoid memory leaks.
        The converter should not free the list of application preferences; the application is responsible for that memory also.
       
        Both preference lists have similar structure. A preference list is a packed string of bytes, with no padding. The first two bytes are a
        short value containing the length of the entire string, including the size of the size short itself. The rest of the string consists
        of arbitrary records. Each record begins with a size byte, followed by an opcode byte. Each size byte includes itself in the size.
       
        The rest of each record contains record-specific data. See the structure below for an example.
       
        To parse the preferences list of the application, a converter must look at the list byte-by-byte, not exceeding the number of bytes
        in the size word, and it must neither assume any particular ordering of opcodes, nor should it assume the presence of any particular opcodes.
       
        Because each record includes its own size, a converter can and should skip unknown opcodes. Parsing the preferences list is somewhat
        analogous to parsing RTF in this respect. The application must parse the preference list from the converter in a similar way.
       
        Because the opcode list is transient and is communicated between two components running on the same system, there is no need for byte-swapping.
        All values should be in native byte order.
       
        While parsing of preference lists must be done byte-by-byte, the lists do not need to be constructed that way. Typically, the list generated
        by a converter is fairly static. It is convenient to build it using a structure:
       
            #pragma pack(1)
            typedef struct
            {
                short cbStruct;  // size of entire structure

                    // version of Word with which converter's Rtf is compliant
                char cbSizeVer;  // == 1 + 1 + 2 + 2
                char opcodeVer;
                short verMajor;  // major version of Word
                short verMinor;  // minor version of Word

                    // character set we want all file names to be in
                char cbSizeCharset; // == 1 + 1 + 1
                char opcodeCharset;
                char charset;

                    // additional values can be added here
            } REGAPPRET;
            #pragma pack()

        This mechanism allows the set of opcodes to grow in a backwards-compatible fashion.
        See the conversions API file Convapi.h for the complete list of currently defined opcodes and their record structures.
        These are the records defined as of Word 97. Many are esoteric and not of general interest. The 'small' valued opcodes are
        for the converter to pass to Word. The opcodes valued 0x80 and above are for Word to pass to the converter.

    Example:
       
        call RegisterApp &REGAPP_PICPLACEHOLD, &NULL
;;

;;
[REGAPPRET:
REGAPPRET.cbStruct: W$ 0 ; size of this structure
REGAPPRET.cbSizefDocfile: B$ 0 ; Does this converter understand docfiles and/or non-docfiles?
REGAPPRET.opcodefDocfile: B$ 0 ; Does this converter understand docfiles and/or non-docfiles?
REGAPPRET.grfType: W$ 0 ; If bit 1 is set it is a doc file
REGAPPRET.cbSizeVer: B$ 0 ; Version of Word for which converter's Rtf is compliant. Always 6 = Is the sum of the byte len above, orsimply: REGAPPRET.cbSizeVerDis
REGAPPRET.opcodeVer: B$ 0 ; idem above
REGAPPRET.verMajor: W$ 0 ; Major version of Word for which Rtf is compliant
REGAPPRET.verMinor: W$ 0 ; Minor version of Word for which Rtf is compliant
REGAPPRET.cbSizeCharset: B$ 0 ; What character set do we want all filenames to be in. Value is always 3
REGAPPRET.opcodeCharset: B$ 0 ; What character set do we want all filenames to be in.
REGAPPRET.charset: B$ 0 ; ANSI &ANSI_CHARSET &OEM_CHARSET
REGAPPRET.opcodesOptional_Val64: B$ 0 ; Is set value is 2.Unknown 871 0367 32 64 067
REGAPPRET.opcodesOptional2_Val64: B$ 0 ;  Is set value is 4
REGAPPRET.opcodesOptional3_Val64: B$ 0 ;  Is set value is 2
REGAPPRET.opcodesOptional_Val256: B$ 0 ; Is set value is 2
REGAPPRET.opcodesOptional2_Val256: B$ 0 ;  Is set value is 5
REGAPPRET.opcodesOptional_Val512: B$ 0 ; Is set value is 2
REGAPPRET.opcodesOptional2_Val512: B$ 0 ;  Is set value is 6
REGAPPRET.opcodesOptional_Val2048: B$ 0 ; Is set value is 2
REGAPPRET.opcodesOptional2_Val2048: B$ 0 ;  Is set value is 11
REGAPPRET.opcodesOptionalReserved: B$ 0 ;  Seems to be an error on the creation of the structure.It is always zero
]

[REGAPPRET.cbStructDis 0
REGAPPRET.cbSizefDocfileDis 2
REGAPPRET.opcodefDocfileDis 3
REGAPPRET.grfTypeDis 4
REGAPPRET.cbSizeVerDis 6
REGAPPRET.opcodeVerDis 7
REGAPPRET.verMajorDis 8
REGAPPRET.verMinorDis 10
REGAPPRET.cbSizeCharsetDis 12
REGAPPRET.opcodeCharsetDis 13
REGAPPRET.charsetDis 14]

[Size_of_REGAPPRET 15] ; unaligned

; Unknown Optional equates
WORD_VERSION 32
OPTIONAL64 64
OPTIONAL256 256
OPTIONAL512 512
OPTIONAL2048 2048
;;


Proc RegisterApp:
    Arguments @lFlags, @lpFuture

    call 'html.iec.RegisterApp' D@lFlags, D@lpFuture

EndP

Coding in Assembly requires a mix of:
80% of brain, passion, intuition, creativity
10% of programming skills
10% of alcoholic levels in your blood.

My Code Sites:
http://rosasm.freeforums.org
http://winasm.tripod.com

guga

InitConverter32 is described as:


;;
    Function: InitConverter32

    An application will call InitConverter32 before any other converter entry point, to pass information not conveniently obtainable
    by the converter any other way, and to permit the converter to perform any necessary global initialization.
   
    Required entrypoint.  Preserve hwndCaller or szModule if you care to use them later.  Provide a DllMain entrypoint and preserve its
    hInstance argument if you care to use that value later, or to protect the DLL from multiple callers if not re-entrant.

    Arguments:
        hWndCaller: A handle to the top-level client window of the application to be used as a parent window for the converter.
                    For example, after displaying and closing a dialog box, a converter should reset the focus to this hwnd.
       
        szModule:   The calling application's module name. The caller must leave the module name accessible throughout
                    the converter session, so that the converter may store this value in a global and access it during a subsequent call.
                    However, it is preferable to copy the string to the converter's data space rather than relying on it remaining in the
                    caller's space. The module name can be used to modify the converter's behavior for different applications.
                    The available module names are:
                        MSWORD
                        WINWORD
                        MSPUB
                        MSWORKS
                        WORDPAD
                        FRONTPG

    Returns:
        True, on suceed
        False, on failure

    Remarks:
            The szModule defines the CodePage of the HTML to be exported as well information about the Generator of the HTML

    Example of usage:
       call 'html.iec.InitConverter32' D$hInstance, {B$ 'MSWORD', 0}
;;

Proc InitConverter32:
    Arguments @hWndCaller, @pSzModule

    call 'html.iec.InitConverter32' D@hWndCaller, D@pSzModule

EndP




WARNING ! Both functions are preliminary, i´m trying to fully understand this dll in order to correctly use it, and make a library for us.
Coding in Assembly requires a mix of:
80% of brain, passion, intuition, creativity
10% of programming skills
10% of alcoholic levels in your blood.

My Code Sites:
http://rosasm.freeforums.org
http://winasm.tripod.com

jj2007

Excellent detective work, Guga :t

These converters are really badly documented, so it is a lot of trial and error until you get it running (and in one case you must do the contrary of what the docs recommend to make it work).

The good thing about HTML.IEC is that it is available even if MS Office is not installed. The bad thing is that Office seems to have much more sophisticated internal HTML converters which can load even complex HTML pages correctly. In some cases, HTML.IEC converts such stuff (e.g. a Google results page) but the usable part is surrounded by a lot of Javascript...

guga

html.iec is the newer version. We should use this instead html32.cnv.The problem seems to be the flags to be used on the register function. The converter seems to be able to manage javascript, images etc, the problem is mainly understand how this shit works.

The documentation is a complete mess, and we must not rely on that completely. It is old (from 97) never got updated, and i doubt M$ will updated it, since, so far i understood, this is the way M$ uses to convert html from rtf and vice-versa without using Office installed.

Once we can understand the exported functions correctly, we can be able to make a single converter to manage all dlls (iec´s and cnv´s) inside the shared tools directory. For example, we can make a function that is able to scan on that directory for all converters available and make a open/save dialog biased on the converters found. Since all iec have the same (or similar) exports, we mainly need that the converter tool, uses a variable that holds the handle of each exported function.

Example:

When we are converting Lotus123 to HTML we can use the lotus converter to open the file. (that will points, for example to call 'lotus32.cnv.RegisterApp'). use the lotus converter to open and manage the file and put it on a memory buffer - or stream them on a richedit control - or any document that is usable on both converters. Example, if lotus123 can export rtf, we use it to export rtf.

Once it is opened (andconverted to rtf), we simply, close the lotus converter and open the html converter on the export functions. So it will get the rtf (that was converted by lotus) and export it to html.


It seems that this is how those converters works, the problem is to make them work.

How you managed to work ForeignToRtf32 ? Can you post an example (to work on masm)


Also, we have an excel.cnv on the shared directory to use, but this is not listed on the registry (Which is not  problem,btw, as long we understand how the export functions works for all cnv files)


Here is what i have in my C:\Program Files\Common Files\Microsoft Shared\TextConv directory
They are vailable here: My Converter dlls
I had do that due to the limitatinsof atachment size on the forum.
Coding in Assembly requires a mix of:
80% of brain, passion, intuition, creativity
10% of programming skills
10% of alcoholic levels in your blood.

My Code Sites:
http://rosasm.freeforums.org
http://winasm.tripod.com

TouEnMasm


This one is a dll called by a c executable,masm if we want.
Use string,i had only "problems" with files(need perhaps some money?).
String is valuable and simple to use.
http://www.htmltortf.com/convert-html-to-rtf-withphp/component-html-text-to-rtf-withphp.php
Fa is a musical note to play with CL

guga

well for U$ 600 and made on .NET i´ll prefer to not even start analysing tis dll  :greensml:
Coding in Assembly requires a mix of:
80% of brain, passion, intuition, creativity
10% of programming skills
10% of alcoholic levels in your blood.

My Code Sites:
http://rosasm.freeforums.org
http://winasm.tripod.com

jj2007

For US$ 600 you could buy office and use my attached 33-lines snippet... MS Word is horribly slow in converting, but the results are convincing  ;)

TouEnMasm

For nothing the string.exe translate html to the console.
I have made several test and i need no more.
I have just had to modify the c source code calling the dll to made it accept parameters.
I am generous this day,I join it.
Just put it in the same directory than the dll,and view.
The only thing needed is the dll.
Fa is a musical note to play with CL