Solved

RTF Control - adding graphics - VB5

Posted on 1997-07-16
4
383 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

763 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

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now