in

AisNote Software

The software can improve your computer work

Great Windows Tool

February 2009 - Posts

  • RTF file research tips

    1. Convert Chinese to Ansii string

          7 int main(int argc, char* argv[])

          8 {

          9     printf("Hello World!\n");

         10 

         11     char chTest[]="电";

         12     int n1 = (unsigned char)(chTest[0]) << 8;

         13     int n2 = (unsigned char)chTest[1];

         14 

         15     int   i   =   n1+n2;  

         16     char   a[3];  

         17     a[0]   =   (char)((i   &   0xff00)   >>   8);  

         18     a[1]   =   (char)(i   &   0xff);  

         19     a[2]   =   0;  

         20     printf("%s\n",a);

         21 

         22     return 0;

         23 }

    2. Some Links:
      rtflib from www.codeproject.com
      rtfx   you can google it.
      latex2rtf from www.sourceforge.net
      gc1039.exe from www.msdn.com.  It will give you some info about how to read rtf file directly using c++.
      http://msdn.microsoft.com/en-us/library/aa140301.aspx
      abiword http://www.abisource.com/   There are a RTF importer/Exporter plugin source code.But I do not familiar with it.
      I think in Windows Platform,you can use RichEdit control to do the below actions:
      Merge 2+ rtf files to one rtf file just use copy and paste,of course you should use TOM or just create 2 hidden richEdt box to switch the data.That is easy.Also you can find the plain text from RTF use EM_GETTEXTEX and stream out a butter then go to find the string what you want catch.
      http://www.codeproject.com/KB/edit/COleRichEditCtrl.aspx?msg=2915564#xx2915564xx  Good sample for OLE such as insert PPT file etc.

    3. RTF have the advantage and disadvantage.I recommended you to use HTML,XML etc.But RTF is good supported by MS.

    4. Search Text:

        497         kREView* pRE = m_view.GetAt(m_view.Active());

        498         if ( pRE )

        499         {

        500             pRE->Load(_T("d:\\dd.rtf"));

        501 

        502             DWORD dwSize = pRE->GetTextLengthEx(GTL_NUMBYTES | GTL_CLOSE, CP_ACP);

        503 

        504             TCHAR *lpszBuffer = new TCHAR[dwSize+2];

        505             memset(lpszBuffer,0,(dwSize+2)*sizeof(TCHAR));

        506 

        507             GETTEXTEX ex = {0};

        508             ex.cb = dwSize+2;

        509             ex.codepage = CP_ACP ;

        510             ex.flags = GT_DEFAULT;

        511 

        512             pRE->GetTextEx(&ex,lpszBuffer);

        513 

        514             CString str = lpszBuffer ;

        515             int nRet = str.Find(_T("我的"));

        516             delete []lpszBuffer ;

        517         }

    5. Directly Get or Set RTF content to a RTF ediotor.Prototype code is below:
      http://www.codeproject.com/KB/edit/rulerricheditctrl.aspx 

      CString CRulerRichEditCtrl::GetRTF()
      /* ============================================================
          Function :        CRulerRichEditCtrl::GetRTF
          Description :    Returns the contents of the control as RTF.
          Access :        Public
          Return :        CString    -    The RTF-contents of the control.
          Parameters :    none

          Usage :            Call this function to get a char buffer
                          with the contents of the embedded RTF-
                          control.

         ============================================================*/
      {

          CString* str = new CString;
          EDITSTREAM    es;
          es.dwCookie = ( DWORD ) str;
          es.pfnCallback = StreamOut;
          m_rtf.StreamOut( SF_RTF, es );

          CString output( *str );
          delete str;

          return output;

      }

      void CRulerRichEditCtrl::SetRTF( const CString& rtf )
      /* ============================================================
          Function :        CRulerRichEditCtrl::SetRTF
          Description :    Set the contents of the embedded RTF-
                          control from rtf.
          Access :        Public
          Return :        void
          Parameters :    const CString& rtf    -    The rtf-contents to
                                                  set.
          Usage :            Call this function to set the RTF-contents
                          of the control.

         ============================================================*/
      {

          CString* str = new CString( rtf );

          EDITSTREAM    es;
          es.dwCookie = ( DWORD ) str;
          es.pfnCallback = StreamIn;
          m_rtf.StreamIn( SF_RTF, es );

          delete str;

      }


      static DWORD CALLBACK StreamIn( DWORD dwCookie, LPBYTE pbBuff, LONG cb, LONG *pcb )

      {
            
      CString* str = ( ( CString* ) dwCookie );

      #ifdef _UNICODE
            
      // Unicode is only supported for SF_TEXT, so we need

             // to convert
             LPCTSTR ptr = str->GetBuffer( (*str).GetLength() );
             int
      length = ::WideCharToMultiByte( CP_UTF8, 0, ptr, -1, NULL, 0, NULL, NULL );
             int
      max = min( cb, length );
             if(
      length )
             {
                    char*
      buff = new char[ length ];
                    ::
      WideCharToMultiByte( CP_UTF8, 0, ptr, -1, buff, length + 1, NULL, NULL );
                   
      strncpy( (LPSTR) pbBuff, buff, max );
                    delete[]
      buff;
             }
            
      str->ReleaseBuffer();

      #else

             int
      max = min( cb, (*str).GetLength() );
            
      strncpy( ( LPSTR ) pbBuff, (*str) , max  );

      #endif

             (*
      str) = (*str).Right( (*str).GetLength() - max );
             *
      pcb = max;
             return 0;
      }



       

  • Great&Free Tools for Your Computer Work

    20081011 add new tools I got from WWW or other friendes recommend.All can be Googled.

    1.Coolplayer:a light-weight MP3 player in Windows.It's opensource.
    2.CDex:
    CDex is a CD-Ripper, extracting digital audio data from an Audio CD. The application supports many Audio encoders, like MPEG (MP2,MP3), VQF, AAC encoders. It can be used to sound recorder.Open source tool.
    3.Paint.Net: MS participated open-source image edit tool which is used to replace mspaint.exe.It wrote in c#.The UE is very good.I like it very much.
    4.PicPick: This tool is closed-source free tool wrote by KO man.I like it too.I often used it to capture the screen and windows bitmap.
    5.isee: 国产的照片管理与电子相册合成application,我用它做了很多电子相册。
    6.flphoto: 也是一个照片管理与相册工具。this is opensource and cross-platform which built in FLTK,这个软件在windows需要自己编译,如果你不会,可以联系我哦。我只喜欢它的slideshow exporter,空了给它加到 llyPiczoomer上。demo is here:http://www.aisnote.com/rhf_wedding/index.html
    不过它对中文支持不好。
    7.llyDict: 在线查词,不说了,直接google吧。
    8.IpMsg: please google it or "飞鸽传书"。非常好的局域网文件传输工具。速度快
    9.FastCopy:这个和ipmsg 同一个作者的。很有名气,不知道,google。
    10.OpenProject: I often got some *.mpp file  for project manage,but I need not to modified it.So I don not want to install the large MS Project applicaton.I just want to view the file.So the openProject is prefered to.
    The main hits are from http://xbeta.info/irfanview-interview.htm 
    11.Winks: Wink is a Tutorial and Presentation creation software, primarily aimed at creating tutorials on how to use software (like a tutor for MS-Word/Excel etc). Using Wink you can capture screenshots, add explanations boxes, buttons, titles etc and generate a highly effective tutorial for your users.录制屏幕的软件很多,但能转为flash的又是免费的就少了。Wink 很棒。最为关键的是它又 鼠标和键盘驱动录制,自由录制,时间录制的功能。真的很棒。

     

    //=====================================

    1.WhereIsIt:a tool for manage your files.

    www.whereisit-soft.com.
    I do want a tool as this.

    Sean( olivi ): 1. 可以导入一个目录
    Sean( olivi ): 2. 可以给单个目录或者文件添加tag
    Sean( olivi ): 3. 可以给单个文件加笔记,就是要有一个txt文件和那个文件可以关联起来
    Sean( olivi ): 4. 可以按照tag进行分类
    liu elliot: 3. tc 可以做到
    支持 unicode

    whereisit可以”离线生成索引“,
    Sean( olivi ): 这个比较赞,这样我可以把我移动硬盘里的资料整理成一个文件
    Sean( olivi ): 不需要连上移动硬盘就能查看有哪些文件

    And I need it to manage my so many e-books which I collected from WWW.

    Today I used this tool in detail.Although the feature is enough to meet my requirement.
    But the user experience is so complex.I do not need all the features.So I decided to
    write a new tool based of this tool by myself if I have spare time.

    //20080522:NND,尽然不是free的,而且功能过于强大,用户体验不怎么好。
    /*  20080523
    * 今天仔细用了一下,发现功能是相当的强大,光导出index report就可以设置很多选项和格式,这个功能对我最需要了。
    */

    2.Locate32:instant access to your file which you want to find
    另外推荐一个open source的文件finder:www.locate32.net very fast to find your disk file because it will create one dabase for your disk and just find the db replace the real disk.So the speed is very fast.
    REF to the site:
    Locate32 is a file finder which works by indexing all your files on your hard disk drive and thus is able to provide almost instant access to them.  For more information, see  the
    About Locate32 page.

    3.BlockNote.net:
    Extremely easy to use Web page editor. Honestly!
    Designed for people who create content for the Web, BlockNote is compact, fast and is as easy to use as a word processor. Its’ simple, user-friendly interface enables even the most novice computer user to import, edit and format web pages—without having to learn any HTML!More detail...
    [aisnote]:Now this tool have a great feature which is can export to PDF.
    //20080912:the "export to PDF" can not support Chinese,so I discarded this tool.


     

aisnote software
Powered by Community Server (Non-Commercial Edition), by Telligent Systems