Solved

RTF Control - adding graphics - VB5

Posted on 1997-07-16
4
387 Views
Last Modified: 2012-08-14
When I add a wmf file to an rtf control using the OleObjects.Add method, windows tries to start up the application associated with the graphic's file extension.  How can I add an image to the rtf control without launching the associated app?  Also, when I save the contents of the control to an RTF file, the file is 32meg, but there is only about 200k worth of data there.  Is there a memory leak?
0
Comment
Question by:swpb
  • 2
4 Comments
 
LVL 5

Accepted Solution

by:
volking earned 120 total points
ID: 1428453
RTF stands for Rich TEXT Format. I emphasize the word TEXT. (So did Microsoft when I called them). The RTF control does not handle graphics. No If's, No And's, No But's ... it does NOT handle graphics.

I needed the same functionality you describe (I even called Microsoft and spent $95 on a Tech Support call!!!!!!) Bottom line, I ended up using the WordPad (a scaled down version of Word) to accomplish what I wanted via OLE.

RTF is for TEXT only ....

============> Frederick
0
 
LVL 5

Expert Comment

by:volking
ID: 1428454
Also, about the SIZE ... depending on what formatting you're using as well as what fonts, the file size can grow tremendously. I even discovered that certain fonts were actually stored INSIDE the RTF file. Something about nonstandard TrueType fonts. Although, 200k to 32 megabytes is quite a large inflation. I don't think I've ever seen that much growth. (and by-the-way, I've written two large scale business applications that use RTF extensively. One of them currently contains approximately 60,000 documents.)

=================> Frederick
0
 

Author Comment

by:swpb
ID: 1428455
You sound a bit pretentious, but your explanation of the file size increase is a good one.  I ended up using the Visual Writer control from Powersoft.  It handles graphics just fine.  Costs less than a tech support call too.
0
 

Expert Comment

by:jugular0
ID: 4268851
VB6 supported RTF codes include \pict, \wbitmap, \wmetafile among others. This means that you can inlude pictures in the RTF control. The RTF control in VB5 may have been more limited. In order to include a bitmap, for example, you would write the following string to the RTFtextbox.

{\pict\wbitmap0\picwN\pichN\picwgoalN\pichgoalN...etc.....\binN  #BDATA}

where the bitmap properties (height, width) can be obtained from the API call GetObject, and the #BDATA is the byte information obtained from the API call GetBitmapBits. Look at the Platform SDK for more information.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

829 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question