RtfconvEx RtfconvStringEx RtfconvCharEx IsRtfconvValidCodePage GetRtfconvLastError AbortRtfconv GetDllVersion |
RTFCONVEXINFO RTFFONTINFO RTFFONTEXINFO RTFLANGIDINFO |
Sample 1   
Sample 2   
Sample 3   
Sample 4   
Sample 5   
Sample 6    Sample 7    Sample 8    Sample 9    Sample 10    |
int WINAPI RtfconvEx ( LPCTSTR pSrcFileName, LPCTSTR pDstFileName, int nSrcCodePage, int nDstCodePage, const RTFCONVEXINFO * pRtfconvExInfo ) ;
LPCTSTR pSrcFileName /* Source filename */ LPCTSTR pSrcFileName /* Destination filename */Specifies the filename of the source and the destination. A filename may be a full pathname, a relative pathname, or a UNC. If the filename is NULL, the function will open stdin or stdout.
int nSrcCodePage /* Source code page */ int nDstCodePage /* Destination code page */Specifies the code page of the source and the destination. You can use the codepage names defined in "rtfconv.h". If the codepage is 0, that means RTF (Rich Text Format) is specified. If the codepage is invalid in the system, the function may load some supplementary DLLs (SBCTBL.DLL, MBCTBL.DLL, CNSTBL.DLL) from the same directory with RTFCONV.DLL.
const RTFCONVEXINFO * pRtfconvExInfo /* Options */Pointer to a RTFCONVEXINFO structure that determines the options of conversion. If this parameter is NULL, the function will perform default conversion.
RTFCONV_SUCCESS Conversion was successful. |
RTFCONV_ERROR_UNKNOWN Occurred unknown errors. |
RTFCONV_ERROR_READ Failed to read the source file. |
RTFCONV_ERROR_WRITE Failed to write the destination file. |
RTFCONV_ERROR_RTFFORMAT Occurred errors of RTF format. |
RTFCONV_ERROR_RTFBRACE Occurred errors of RTF format. |
RTFCONV_ERROR_MEMORY Failed to allocate required memory. |
RTFCONV_ERROR_CODEPAGE The code page is invalid. |
RTFCONV_ERROR_ABORTED Aborted by AbortRtfconv during conversion. |
RTFCONV_ERROR_PARAM Specified parameters are invalid. |
intptr_t WINAPI RtfconvStringEx ( const void * pSrcBuffer, void * pDstBuffer, int nSrcCodePage, int nDstCodePage, const RTFCONVEXINFO * pRtfconvExInfo, size_t nMaxLen ) ;
const void * pSrcBuffer /* Pointer to the source string */ void * pDstBuffer /* Pointer to the destination buffer */Specifies the pointer to the source string and the destination buffer. Both are declared as a void pointer, so you can specify char or wchar_t string buffers without cast. The string pointed to by pSrcBuffer must be null-terminated. If the same address is specified to pSrcBuffer and pDstBuffer, the result of conversion is undefined.
int nSrcCodePage /* Source codepage */ int nDstCodePage /* Destination codepage */Specifies the code page of the source and the destination. You can use the codepage names defined in "rtfconv.h". If the codepage is 0, that means RTF (Rich Text Format) is specified. If the codepage is invalid in the system, the function may load some supplementary DLLs (SBCTBL.DLL, MBCTBL.DLL, CNSTBL.DLL) from the same directory with RTFCONV.DLL.
const RTFCONVEXINFO * pRtfconvExInfo /* Options */Pointer to a RTFCONVEXINFO structure that determines the options of conversion. If this parameter is NULL, the function will perform default conversion.
size_t nMaxLen /* Size of destination buffer */Specifies the size of destination buffer, in bytes.
int WINAPI RtfconvCharEx ( int C, int nSrcCodePage, int nDstCodePage, const RTFCONVEXINFO * pRtfconvExInfo ) ;
int C /* Character */Specifies a character code.
int nSrcCodePage /* Source codepage */ int nDstCodePage /* Destination codepage */Specifies the code page of the source and the destination. You can use the codepage names defined in "rtfconv.h". If the codepage is 0, that means RTF (Rich Text Format) is specified. If the codepage is invalid in the system, the function may load some supplementary DLLs (SBCTBL.DLL, MBCTBL.DLL, CNSTBL.DLL) from the same directory with RTFCONV.DLL.
const RTFCONVEXINFO * pRtfconvExInfo /* Options */Pointer to a RTFCONVEXINFO structure that determines the options of conversion. If this parameter is NULL, the function will perform default conversion.
int WINAPI IsRtfconvValidCodePage ( int nCodePage ) ;
int WINAPI GetRtfconvLastError ( void ) ;
RTFCONV_SUCCESS Conversion was successful. |
RTFCONV_ERROR_UNKNOWN Occurred unknown errors. |
RTFCONV_ERROR_READ Failed to read the source file. |
RTFCONV_ERROR_WRITE Failed to write the destination file. |
RTFCONV_ERROR_RTFFORMAT Occurred errors of RTF format. |
RTFCONV_ERROR_RTFBRACE Occurred errors of RTF format. |
RTFCONV_ERROR_MEMORY Failed to allocate required memory. |
RTFCONV_ERROR_CODEPAGE The code page is invalid. |
RTFCONV_ERROR_ABORTED Aborted by AbortRtfconv during conversion. |
RTFCONV_ERROR_PARAM Specified parameters are invalid. |
int WINAPI AbortRtfconv ( void ) ;
int WINAPI GetDllVersion ( void ) ;
typedef struct { size_t cbSize ; unsigned long dwConversionMode ; unsigned long dwAdditionalMode ; const char * pUnmappableCharFormat ; int nDefaultCjkCodePage ; int nFontSize ; const RTFFONTINFO * pFontInfo ; const RTFFONTEXINFO * pFontExInfo ; size_t nNumberOfFontExInfo ; const RTFLANGIDINFO * pLangIdInfo ; size_t nNumberOfLangIdInfo ; const void * pReserved ; } RTFCONVEXINFO ;
CONVMODE_PEEKMESSAGE Peek messages during conversion. |
CONVMODE_OUTPUT_CODE_NUMBER Write its Unicode Number like "[UNICODE:hhh]" for unmappable characters. You can change the format by pUnmappableCharFormat. |
CONVMODE_OUTPUT_CODE_NUMBER_HTML Write its Unicode Number like "hhh" for unmappable characters. |
CONVMODE_OUTPUT_NUMBER_SURROGATE Write its Unicode Number by UTF-16 surrogate pair when specified CONVMODE_OUTPUT_CODE_NUMBER or CONVMODE_OUTPUT_CODE_NUMBER_HTML . |
CONVMODE_INPUT_CODE_NUMBER_HTML Recognize nnn; or hhh; as Unicode Character. |
CONVMODE_NO_VARIANT_KANJI Do not convert to character variants. This flag is valid for characters above U+2E80. |
CONVMODE_NO_VARIANT_EUROPEAN Do not convert to character variants. This flag is valid for characters under U+2E7F. |
CONVMODE_NO_VARIANT Do not convert to character variants. This flag is equivalent to the combination of CONVMODE_NO_VARIANT_KANJI and CONVMODE_NO_VARIANT_EUROPEAN . |
CONVMODE_VARIANT_ONLY_ROUNDTRIP Convert to character variants only when the conversion is "roundtrippable". |
CONVMODE_CONVERT_PUA Enable to convert Private Use Area. |
CONVMODE_NO_HANKANA Convert single-byte kana to double-byte. |
CONVMODE_NO_ZENALPHA Convert double-byte alphabets and digits to single-byte. |
CONVMODE_NO_ZENSPACE Convert double-byte space to single-byte. |
CONVMODE_NO_ZENSYMBOL Convert double-byte symbols to single-byte. |
CONVMODE_YEN_NO_BACKSLASH Convert Japanese/Korean single-byte Yen/Won Sign to U+A5/U+20A9, not to backslash. |
CONVMODE_USE_LOCAL_FONT Write the same font for double-byte characters and single-byte characters on writing RTF. |
CONVMODE_NO_GBK Write GB2312 only (on writing Chinese Simplified). |
CONVMODE_OUTPUT_GB18030 Write GB2312 + GBK + GB18030 (on writing Chinese Simplified). |
CONVMODE_NO_CW Do not recognize the fonts of Chinese Writer, Korean Writer and SIL in RTF. |
CONVMODE_OUTPUT_RUBY Write Ruby (Pronunciation Guide) of RTF. |
CONVMODE_OUTPUT_LINK Write Hyperlinks of RTF. |
CONVMODE_OUTPUT_HIDDEN Write Hidden Characters of RTF. |
CONVMODE_OUTPUT_CR Write CR only. |
CONVMODE_OUTPUT_LF Write LF only. |
CONVMODE_USE_DLL_TABLE Always use SBCTBL.DLL, MBCTBL.DLL. |
CONVMODE_USE_SYSTEM_TABLE Never use SBCTBL.DLL, MBCTBL.DLL. |
CONVMODE_NO_OUTPUT_BOM Do not write a Byte Order Marks (on writing UTF-16/32). |
CONVMODE_UTF8_WITH_BOM Write a Byte Order Mark (on writing UTF-8). |
CONVMODE_ENDIAN_AUTO Detect the Endian automatically (on reading UTF16/32). |
CONVMODE_EUC_HOJO Write JIS X 0212 (Hojo Kanji) of EUC-JP |
ADDITIONAL_MODE_JIS_INPUT_MAC Read Japanese text by Macintosh Japanese Character Set. |
ADDITIONAL_MODE_JIS_OUTPUT_MAC Write Japanese text by Macintosh Japanese Character Set. |
ADDITIONAL_MODE_JIS_OUTPUT_NO_VENDOR Do not write Japanese Vendor Characters. Write Japanese text by JIS X 0208:1997. |
ADDITIONAL_MODE_JIS_INPUT_NO_VENDOR Do not read Japanese Vendor Characters. Read Japanese text by JIS X 0208:1997. |
ADDITIONAL_MODE_JIS_INPUT_2004 Read Japanese text by JIS X 0213:2004. |
ADDITIONAL_MODE_JIS_OUTPUT_2004 Write Japanese text by JIS X 0213:2004. |
ADDITIONAL_MODE_JIS_NO_JIS83_NEW_STYLE Do not write JIS83 new style characters. |
ADDITIONAL_MODE_JIS_NO_JIS83_OLD_STYLE Do not write JIS83 old style characters. |
ADDITIONAL_MODE_GBK_TO_LINSHIDAIMA Convert GBK to Unicode PUA (GB13000 Linshi Daima). |
ADDITIONAL_MODE_LINSHIDAIMA_TO_GBK Convert Unicode PUA (GB13000 Linshi Daima) to GBK. |
ADDITIONAL_MODE_PUA_TO_HKSCS Convert PUA to HKSCS (on writing HKSCS). |
ADDITIONAL_MODE_HKSCS_CJKA_TO_PUA Convert CJK Ex.A to PUA (on reading HKSCS). |
ADDITIONAL_MODE_HKSCS_CJKB_TO_PUA Convert CJK Ex.B to PUA (on reading HKSCS). |
ADDITIONAL_MODE_HKSCS_CJK41_TO_PUA Convert Unicode 4.1 or later to PUA (on reading HKSCS). |
ADDITIONAL_MODE_HKSCS_ALL_TO_PUA Convert all characters to PUA if can (on reading HKSCS). |
ADDITIONAL_MODE_HKSCS_1999 Convert to HKSCS-1999 (on writing HKSCS). |
ADDITIONAL_MODE_HKSCS_2001 Convert to HKSCS-2001 (on writing HKSCS). |
ADDITIONAL_MODE_KS_NO_UHC Do not write Korean UHC extended characters (on writing Korean). |
ADDITIONAL_MODE_KS_PUNC Convert U+3001 and U+3002 to "comma" and "full stop" (on writing Korean). |
CONVMODE_OUTPUT_CODE_NUMBER
is specified to dwConversionMode. The syntax of this string follows the format of printf(). If this member is NULL, the function will use the default format.typedef struct { size_t cbSize ; const char * pEuropean ; const char * pJapanese ; const char * pChineseSimplified ; const char * pChineseTraditional ; const char * pKorean ; const char * pThai ; } RTFFONTINFO ;
typedef struct { int C ; const char * pFont ; } RTFFONTEXINFO ;
typedef struct { int C ; int nLangId ; } RTFLANGIDINFO ;
/* Convert a Japanese Text File to Unicode */ #include <windows.h> #include "rtfconv.h" typedef int (WINAPI *RTFCONVEX) ( LPCTSTR pSrcFileName, LPCTSTR pDstFileName, int nSrcCodePage, int nDstCodePage, const RTFCONVEXINFO *pRtfconvExInfo ) ; int main () { /* DLL */ HINSTANCE hRtfconv ; RTFCONVEX pRtfconvEx ; /* Reading DLL */ hRtfconv = LoadLibrary( TEXT("rtfconv.dll") ) ; if ( hRtfconv == NULL ) { return 1 ; } #ifdef UNICODE pRtfconvEx = (RTFCONVEX) GetProcAddress( hRtfconv, "RtfconvExW" ) ; #else pRtfconvEx = (RTFCONVEX) GetProcAddress( hRtfconv, "RtfconvExA" ) ; #endif if ( pRtfconvEx == NULL ) { FreeLibrary( hRtfconv ) ; return 1 ; } /* Conversion */ pRtfconvEx ( TEXT("c:\\foo.txt"), TEXT("c:\\poo.txt"), CP_JAPANESE, CP_UTF16, NULL ) ; /* Finalization */ FreeLibrary( hRtfconv ) ; return 0 ; }
/* Convert a Japanese Text File to RTF. */ #include <windows.h> #include "rtfconv.h" typedef int (WINAPI *RTFCONVEX) ( LPCTSTR pSrcFileName, LPCTSTR pDstFileName, int nSrcCodePage, int nDstCodePage, const RTFCONVEXINFO *pRtfconvExInfo ) ; int main () { /* DLL */ HINSTANCE hRtfconv ; RTFCONVEX pRtfconvEx ; /* Reading DLL */ hRtfconv = LoadLibrary( TEXT("rtfconv.dll") ) ; if ( hRtfconv == NULL ) { return 1 ; } #ifdef UNICODE pRtfconvEx = (RTFCONVEX) GetProcAddress( hRtfconv, "RtfconvExW" ) ; #else pRtfconvEx = (RTFCONVEX) GetProcAddress( hRtfconv, "RtfconvExA" ) ; #endif if ( pRtfconvEx == NULL ) { FreeLibrary( hRtfconv ) ; return 1 ; } /* Conversion */ pRtfconvEx ( TEXT("c:\\foo.txt"), TEXT("c:\\poo.rtf"), CP_JAPANESE, 0, NULL ) ; /* Finalization */ FreeLibrary( hRtfconv ) ; return 0 ; }
/* Convert a Japanese Text File to ISO-2022-JP, and convert half-width katakanas */ /* to their full-width equivalents. */ #include <windows.h> #include "rtfconv.h" typedef int (WINAPI *RTFCONVEX) ( LPCTSTR pSrcFileName, LPCTSTR pDstFileName, int nSrcCodePage, int nDstCodePage, const RTFCONVEXINFO *pRtfconvExInfo ) ; int main () { /* DLL */ HINSTANCE hRtfconv ; RTFCONVEX pRtfconvEx ; /* Structures */ RTFCONVEXINFO RtfconvExInfo = { sizeof(RTFCONVEXINFO) } ; /* Reading DLL */ hRtfconv = LoadLibrary( TEXT("rtfconv.dll") ) ; if ( hRtfconv == NULL ) { return 1 ; } #ifdef UNICODE pRtfconvEx = (RTFCONVEX) GetProcAddress( hRtfconv, "RtfconvExW" ) ; #else pRtfconvEx = (RTFCONVEX) GetProcAddress( hRtfconv, "RtfconvExA" ) ; #endif if ( pRtfconvEx == NULL ) { FreeLibrary( hRtfconv ) ; return 1 ; } /* Options */ RtfconvExInfo.dwConversionMode = CONVMODE_NO_HANKANA ; /* Conversion */ pRtfconvEx ( TEXT("c:\\foo.txt"), TEXT("c:\\poo.txt"), CP_JAPANESE, CP_ISO_JAPANESE, & RtfconvExInfo ) ; /* Finalization */ FreeLibrary( hRtfconv ) ; return 0 ; }
/* Convert a Unicode String "hello, world!" to Western European codepage, and */ /* display it by MessageBox */ #include <windows.h> #include "rtfconv.h" typedef intptr_t (WINAPI *RTFCONVSTRINGEX) ( const void *pSrcBuffer, void *pDstBuffer, int nSrcCodePage, int nDstCodePage, const RTFCONVEXINFO *pRtfconvExInfo, size_t nMaxLen ) ; int main () { char szBuffer [ 0x100 ] ; /* DLL */ HINSTANCE hRtfconv ; RTFCONVSTRINGEX pRtfconvStringEx ; /* Reading DLL */ hRtfconv = LoadLibrary( TEXT("rtfconv.dll") ) ; if ( hRtfconv == NULL ) { return 1 ; } pRtfconvStringEx = (RTFCONVSTRINGEX) GetProcAddress( hRtfconv, "RtfconvStringEx" ) ; if ( pRtfconvStringEx == NULL ) { FreeLibrary( hRtfconv ) ; return 1 ; } /* Conversion */ pRtfconvStringEx( L"hello, world!", szBuffer, CP_UTF16, 1252, NULL, sizeof(szBuffer) ); /* Display */ MessageBoxA( NULL, szBuffer, "test", MB_OK ) ; /* Finalization */ FreeLibrary( hRtfconv ) ; return 0 ; }
/* Convert a Japanese Text File to RTF, with "Arial" to Ascii characters, */ /* "MS PGothic" to Japanese characters. */ #include <windows.h> #include "rtfconv.h" typedef int (WINAPI *RTFCONVEX) ( LPCTSTR pSrcFileName, LPCTSTR pDstFileName, int nSrcCodePage, int nDstCodePage, const RTFCONVEXINFO *pRtfconvExInfo ) ; int main () { /* DLL */ HINSTANCE hRtfconv ; RTFCONVEX pRtfconvEx ; /* Structures */ RTFCONVEXINFO RtfconvExInfo = { sizeof(RTFCONVEXINFO) } ; RTFFONTINFO FontInfo = { sizeof(RTFFONTINFO) } ; /* Reading DLL */ hRtfconv = LoadLibrary( TEXT("rtfconv.dll") ) ; if ( hRtfconv == NULL ) { return 1 ; } #ifdef UNICODE pRtfconvEx = (RTFCONVEX) GetProcAddress( hRtfconv, "RtfconvExW" ) ; #else pRtfconvEx = (RTFCONVEX) GetProcAddress( hRtfconv, "RtfconvExA" ) ; #endif if ( pRtfconvEx == NULL ) { FreeLibrary( hRtfconv ) ; return 1 ; } /* Options */ FontInfo.pEuropean = "Arial" ; FontInfo.pJapanese = "MS PGothic" ; RtfconvExInfo.pFontInfo = & FontInfo ; /* Conversion */ pRtfconvEx ( TEXT("c:\\foo.txt"), TEXT("c:\\poo.rtf"), CP_JAPANESE, 0, & RtfconvExInfo ) ; /* Finalization */ FreeLibrary( hRtfconv ) ; return 0 ; }
/* Convert a Japanese Text File to RTF, with "MS PGothic" to all */ /* characters. */ #include <windows.h> #include "rtfconv.h" typedef int (WINAPI *RTFCONVEX) ( LPCTSTR pSrcFileName, LPCTSTR pDstFileName, int nSrcCodePage, int nDstCodePage, const RTFCONVEXINFO *pRtfconvExInfo ) ; int main () { /* DLL */ HINSTANCE hRtfconv ; RTFCONVEX pRtfconvEx ; /* Structures */ RTFCONVEXINFO RtfconvExInfo = { sizeof(RTFCONVEXINFO) } ; RTFFONTINFO FontInfo = { sizeof(RTFFONTINFO) } ; /* Reading DLL */ hRtfconv = LoadLibrary( TEXT("rtfconv.dll") ) ; if ( hRtfconv == NULL ) { return 1 ; } #ifdef UNICODE pRtfconvEx = (RTFCONVEX) GetProcAddress( hRtfconv, "RtfconvExW" ) ; #else pRtfconvEx = (RTFCONVEX) GetProcAddress( hRtfconv, "RtfconvExA" ) ; #endif if ( pRtfconvEx == NULL ) { FreeLibrary( hRtfconv ) ; return 1 ; } /* Options */ FontInfo.pJapanese = "MS PGothic" ; RtfconvExInfo.pFontInfo = & FontInfo ; RtfconvExInfo.dwConversionMode = CONVMODE_USE_LOCAL_FONT ; /* Conversion */ pRtfconvEx ( TEXT("c:\\foo.txt"), TEXT("c:\\poo.rtf"), CP_JAPANESE, 0, & RtfconvExInfo ) ; /* Finalization */ FreeLibrary( hRtfconv ) ; return 0 ; }
/* Convert a KOI8-U text file to RTF. */ /* Write Ukrainian LangId to Cyrillic characters. */ #include <windows.h> #include "rtfconv.h" typedef int (WINAPI *RTFCONVEX) ( LPCTSTR pSrcFileName, LPCTSTR pDstFileName, int nSrcCodePage, int nDstCodePage, const RTFCONVEXINFO *pRtfconvExInfo ) ; int main () { /* DLL */ HINSTANCE hRtfconv ; RTFCONVEX pRtfconvEx ; /* Structures */ RTFCONVEXINFO RtfconvExInfo = { sizeof(RTFCONVEXINFO) } ; RTFLANGIDINFO LangIdInfo [] = { { 0x0400, MAKELANGID( LANG_UKRAINIAN, SUBLANG_DEFAULT ) }, /* Cyrillic (0x0400`0x04FF) */ } ; /* Reading DLL */ hRtfconv = LoadLibrary( TEXT("rtfconv.dll") ) ; if ( hRtfconv == NULL ) { return 1 ; } #ifdef UNICODE pRtfconvEx = (RTFCONVEX) GetProcAddress( hRtfconv, "RtfconvExW" ) ; #else pRtfconvEx = (RTFCONVEX) GetProcAddress( hRtfconv, "RtfconvExA" ) ; #endif if ( pRtfconvEx == NULL ) { FreeLibrary( hRtfconv ) ; return 1 ; } /* Options */ RtfconvExInfo.pLangIdInfo = LangIdInfo ; RtfconvExInfo.nNumberOfLangIdInfo = sizeof(LangIdInfo) / sizeof(LangIdInfo[0]) ; /* Conversion */ pRtfconvEx ( TEXT("c:\\foo.txt"), TEXT("c:\\poo.rtf"), CP_CYRILLIC_KOI8U, 0, & RtfconvExInfo ) ; /* Finalization */ FreeLibrary( hRtfconv ) ; return 0 ; }
/* Convert Unicode Text File to RTF. */ /* Write Yi characters with font "SIL Yi" */ #include <windows.h> #include "rtfconv.h" typedef int (WINAPI *RTFCONVEX) ( LPCTSTR pSrcFileName, LPCTSTR pDstFileName, int nSrcCodePage, int nDstCodePage, const RTFCONVEXINFO *pRtfconvExInfo ) ; int main () { /* DLL */ HINSTANCE hRtfconv ; RTFCONVEX pRtfconvEx ; /* Structures */ RTFCONVEXINFO RtfconvExInfo = { sizeof(RTFCONVEXINFO) } ; RTFFONTEXINFO FontExInfo [] = { { 0xA000, "SIL Yi" }, /* Yi Syllables (0xA000`0xA48F) */ { 0xA490, "SIL Yi" }, /* Yi Radicals (0xA490`0xA4CF) */ } ; /* Reading DLL */ hRtfconv = LoadLibrary( TEXT("rtfconv.dll") ) ; if ( hRtfconv == NULL ) { return 1 ; } #ifdef UNICODE pRtfconvEx = (RTFCONVEX) GetProcAddress( hRtfconv, "RtfconvExW" ) ; #else pRtfconvEx = (RTFCONVEX) GetProcAddress( hRtfconv, "RtfconvExA" ) ; #endif if ( pRtfconvEx == NULL ) { FreeLibrary( hRtfconv ) ; return 1 ; } /* Options */ RtfconvExInfo.pFontExInfo = FontExInfo ; RtfconvExInfo.nNumberOfFontExInfo = sizeof(FontExInfo) / sizeof(FontExInfo[0]) ; /* Conversion */ pRtfconvEx ( TEXT("c:\\foo.txt"), TEXT("c:\\poo.rtf"), CP_UTF16, 0, & RtfconvExInfo ) ; /* Finalization */ FreeLibrary( hRtfconv ) ; return 0 ; }
/* Convert a Japanese Text File to Unicode. */ /* Write '?' for unmappable characters. */ #include <windows.h> #include "rtfconv.h" typedef int (WINAPI *RTFCONVEX) ( LPCTSTR pSrcFileName, LPCTSTR pDstFileName, int nSrcCodePage, int nDstCodePage, const RTFCONVEXINFO *pRtfconvExInfo ) ; int main () { /* DLL */ HINSTANCE hRtfconv ; RTFCONVEX pRtfconvEx ; /* Structures */ RTFCONVEXINFO RtfconvExInfo = { sizeof(RTFCONVEXINFO) } ; /* Reading DLL */ hRtfconv = LoadLibrary( TEXT("rtfconv.dll") ) ; if ( hRtfconv == NULL ) { return 1 ; } #ifdef UNICODE pRtfconvEx = (RTFCONVEX) GetProcAddress( hRtfconv, "RtfconvExW" ) ; #else pRtfconvEx = (RTFCONVEX) GetProcAddress( hRtfconv, "RtfconvExA" ) ; #endif if ( pRtfconvEx == NULL ) { FreeLibrary( hRtfconv ) ; return 1 ; } /* Options */ RtfconvExInfo.pUnmappableCharFormat = "?" ; RtfconvExInfo.dwConversionMode = CONVMODE_OUTPUT_CODE_NUMBER ; /* Conversion */ pRtfconvEx ( TEXT("c:\\foo.txt"), TEXT("c:\\poo.txt"), CP_UTF16, CP_JAPANESE, & RtfconvExInfo ) ; /* Finalization */ FreeLibrary( hRtfconv ) ; return 0 ; }
/* Convert a Chinese Simplified Text File to Japanese. */ /* Write [UC+HHHH] (hexadecimal digits) for unmappable characters. */ #include <windows.h> #include "rtfconv.h" typedef int (WINAPI *RTFCONVEX) ( LPCTSTR pSrcFileName, LPCTSTR pDstFileName, int nSrcCodePage, int nDstCodePage, const RTFCONVEXINFO *pRtfconvExInfo ) ; int main () { /* DLL */ HINSTANCE hRtfconv ; RTFCONVEX pRtfconvEx ; /* Structures */ RTFCONVEXINFO RtfconvExInfo = { sizeof(RTFCONVEXINFO) } ; /* Reading DLL */ hRtfconv = LoadLibrary( TEXT("rtfconv.dll") ) ; if ( hRtfconv == NULL ) { return 1 ; } #ifdef UNICODE pRtfconvEx = (RTFCONVEX) GetProcAddress( hRtfconv, "RtfconvExW" ) ; #else pRtfconvEx = (RTFCONVEX) GetProcAddress( hRtfconv, "RtfconvExA" ) ; #endif if ( pRtfconvEx == NULL ) { FreeLibrary( hRtfconv ) ; return 1 ; } /* Options */ RtfconvExInfo.pUnmappableCharFormat = "[UC+%04X]" ; RtfconvExInfo.dwConversionMode = CONVMODE_OUTPUT_CODE_NUMBER ; /* Conversion */ pRtfconvEx ( TEXT("c:\\foo.txt"), TEXT("c:\\poo.txt"), CP_CHINESE_SIMPLIFIED, CP_JAPANESE, & RtfconvExInfo ) ; /* Finalization */ FreeLibrary( hRtfconv ) ; return 0 ; }