Solved

RTF Control - adding graphics - VB5

Posted on 1997-07-16
4
385 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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
VBA error replacing data 6 40
Using "ScreenUpdating" 6 65
message box in access 4 46
backup program with robocopy 6 22
Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
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…

810 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