Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
E

eco

@eco
About
Posts
2
Topics
0
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Get the size of RTF text on a print DC
    E eco

    arg mistake, read that 2. obtain the IID_ITextServices : (GUID*)(GetProcAddress( hRichDll, "IID_ITextServices" ))

    C / C++ / MFC help tutorial question

  • Get the size of RTF text on a print DC
    E eco

    There is another solution: using windowless richedit but you'll need to know COM 1. loadlibrary richedit.dll 2. obtain the CreateTextServices proc : GetProcAddress( hRichDll, "CreateTextServices" ) 2. obtain the IID_ITextService : (GUID*)(GetProcAddress( hRichDll, "IID_ITextHost" )) 3. create an instance of ITextHost (a dummy one) .. read the doc 3. call query interfce for the ITextService IUnknown* unk = NULL; (*fnCreateServices)( NULL, &m_TextHost, &unk ); unk->QueryInterface( g_RichService, (void**)&m_Service ); unk->Release( );4. send the rtf to the service m_Service->TxSendMessage( EM_STREAMIN, SF_RTF, ... (doc)... ) 5. ask the natural size long forHeight = 1; SIZEL sze; sze.cx = forWidth; sze.cy = forHeight; m_Service->TxGetNaturalSize( DVASPECT_DOCPRINT, m_hDC, 0, NULL, TXTNS_FITTOCONTENT, (SIZEL*) &sze, &forWidth, &forHeight ); i cannot give you the whole source of the implementation of ITextHost because it should be too long, but read the ITextHost doc and implement the strict minimum. i use that way to create dynamic rtf, calculate rtf display size, print rtf ... notice that under XP, you should use 'msftedit.dll' instead of 'richedit.dll' msftedit is really really faster. good luke ;)

    C / C++ / MFC help tutorial question
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups