Solved

RTF Control - adding graphics - VB5

Posted on 1997-07-16
4
390 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
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…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…

728 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