Click here to Skip to main content
15,900,258 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Generalthe problem of SEH Pin
crazyzhou2-Sep-03 21:18
crazyzhou2-Sep-03 21:18 
GeneralRe: the problem of SEH Pin
Brad Sokol3-Sep-03 3:04
Brad Sokol3-Sep-03 3:04 
GeneralRe: the problem of SEH Pin
crazyzhou3-Sep-03 19:14
crazyzhou3-Sep-03 19:14 
GeneralRe: the problem of SEH Pin
Brad Sokol4-Sep-03 2:47
Brad Sokol4-Sep-03 2:47 
Generalwhen i install ms SDK.... Pin
Anonymous2-Sep-03 21:02
Anonymous2-Sep-03 21:02 
GeneralRe: when i install ms SDK.... Pin
John R. Shaw3-Sep-03 6:21
John R. Shaw3-Sep-03 6:21 
GeneralGet the size of RTF text on a print DC Pin
CodeBrain2-Sep-03 20:41
CodeBrain2-Sep-03 20:41 
GeneralRe: Get the size of RTF text on a print DC Pin
eco2-Sep-03 21:09
eco2-Sep-03 21:09 
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;<br />
    (*fnCreateServices)( NULL, &m_TextHost, &unk );<br />
    unk->QueryInterface( g_RichService, (void**)&m_Service );<br />
    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;<br />
   SIZEL sze;<br />
   sze.cx	= forWidth;<br />
   sze.cy	= forHeight;<br />
<br />
   m_Service->TxGetNaturalSize( DVASPECT_DOCPRINT, m_hDC, 0, NULL, TXTNS_FITTOCONTENT, (SIZEL*)<br />
                                 &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 Wink | ;)
GeneralRe: Get the size of RTF text on a print DC Pin
eco2-Sep-03 21:12
eco2-Sep-03 21:12 
GeneralRe: Get the size of RTF text on a print DC Pin
CodeBrain3-Sep-03 3:21
CodeBrain3-Sep-03 3:21 
QuestionUnicode issue? How to resolve? Pin
Yu Zhiquan2-Sep-03 20:15
Yu Zhiquan2-Sep-03 20:15 
GeneralMFC Gurus Only1 Pin
John R. Shaw2-Sep-03 19:24
John R. Shaw2-Sep-03 19:24 
GeneralRe: MFC Gurus Only1 Pin
Joey Bloggs2-Sep-03 20:22
Joey Bloggs2-Sep-03 20:22 
GeneralRe: MFC Gurus Only1 Pin
John R. Shaw3-Sep-03 6:14
John R. Shaw3-Sep-03 6:14 
GeneralRe: MFC Gurus Only1 Pin
John R. Shaw3-Sep-03 8:20
John R. Shaw3-Sep-03 8:20 
QuestionHow to get redrew rectangel of screen? Pin
greatesky2-Sep-03 15:18
greatesky2-Sep-03 15:18 
AnswerRe: How to get redrew rectangel of screen? Pin
John R. Shaw2-Sep-03 20:07
John R. Shaw2-Sep-03 20:07 
GeneralMSBNx API help... Pin
JoeSox2-Sep-03 14:18
JoeSox2-Sep-03 14:18 
GeneralI still don't get it... Pin
Roger Knowles2-Sep-03 13:59
sussRoger Knowles2-Sep-03 13:59 
GeneralRe: I still don't get it... Pin
valikac2-Sep-03 14:19
valikac2-Sep-03 14:19 
GeneralRe: I still don't get it... Pin
rajdawg2-Sep-03 15:50
rajdawg2-Sep-03 15:50 
GeneralRe: I still don't get it... Pin
vcplusplus2-Sep-03 14:27
vcplusplus2-Sep-03 14:27 
GeneralRe: I still don't get it... Pin
rajdawg2-Sep-03 15:53
rajdawg2-Sep-03 15:53 
GeneralNewbie question on MFC Controls Pin
Binayak2-Sep-03 13:33
Binayak2-Sep-03 13:33 
GeneralRe: Newbie question on MFC Controls Pin
Shog92-Sep-03 16:26
sitebuilderShog92-Sep-03 16:26 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.