Solved

RichTextBox1.OLEObjects.Add

Posted on 2002-04-15
8
765 Views
Last Modified: 2007-12-19
Hi
I am using RichTextBox1.OLEObjects.Add to adding smile images to my chat but I am facing problem whenever I call this method it create instance of mspaint object, suppose I am added 50 smile images into my RichTextBox it creates 50 instance of mspaint, these instance are hidden but when u press ctrl+alt+del then see the close program widow where 50 instance of mspaint these instance only removed when chat from unload.

if you have any idea that whenever I call this method it add smile image into RichTextBox without creating  a instance of mspaint.

but don't send the copy image to clipboard and paste into RichTextBox.

rajender
0
Comment
Question by:rajunegi
[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
8 Comments
 
LVL 1

Expert Comment

by:cbitservices
ID: 6941421
Hi Rajender,

I have used the Add command without any such problems. Perhaps it is the way you are doing it? A piece of code from my program follows, this uses a common dialog to select and then add the object:

With FMainForm.dlgCommonDialog
        .Filter = "bitmap (*.bmp)|*.bmp|GIF (*.gif)|*.gif|JPG (*.jpg)|*.jpg"
        .ShowOpen
        rtfPage(0).OLEObjects.Add , , .Filename
End With

(rtfPage(0) is a RichTextBox).

Hope this helps.

Cheers,

Colin.
0
 

Expert Comment

by:reddy_rk
ID: 6941794
this code also creates mspaint object if press ctrl+alt-del key then u see close program window where is instance name mspaint

With FMainForm.dlgCommonDialog
       .Filter = "bitmap (*.bmp)|*.bmp|GIF (*.gif)|*.gif|JPG (*.jpg)|*.jpg"
       .ShowOpen
       rtfPage(0).OLEObjects.Add , , .Filename
End With

0
 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 6942134
did you do this question before?
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 28

Accepted Solution

by:
AzraSound earned 200 total points
ID: 6942518
No way around it with OLEObjects collection.  The picture is embedded as an object, such that when it receives focus, the application associated with that object is activated so that it can be edited.  The best you can do sticking with OLEObjects is to hide the application, and then remove focus from the object so that the corresponding application is unloaded, e.g.,


With RichTextBox
    .OLEObjects.Add(, , FileName).DoVerb(-3)
    .SelStart = Len(.Text)
    .SelLength = 0
End With
0
 
LVL 16

Expert Comment

by:twalgrave
ID: 7755064
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in Community Support that this question is:
- PAQ/no refund
Please leave any comments here within the
next seven days.
0
 
LVL 1

Expert Comment

by:cbitservices
ID: 7764856
The fact that there is no way around obviously IS an answer surely! AzraSound should therefore get the points!

Fair's Fair!!!!

Colin.
0
 
LVL 1

Expert Comment

by:cbitservices
ID: 7764889
Just a thought, but if you KNOW the instances are being created, perhaps you could KILL them!? That would at least release the resources! I would reject points for that sick comment anyway! Just thinking out aloud!

Regards,

Colin.
0
 

Expert Comment

by:SpideyMod
ID: 7812505
Points awarded

SpideyMod
Community Support Moderator @Experts Exchange
0

Featured Post

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

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

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
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…
Suggested Courses
Course of the Month8 days, 9 hours left to enroll

617 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