Solved

RichTextBox1.OLEObjects.Add

Posted on 2002-04-15
8
741 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
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
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 
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

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

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

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
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…
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…

772 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