Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

RichTextBox1.OLEObjects.Add

Posted on 2002-04-15
8
Medium Priority
?
774 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
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 800 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

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…
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 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…
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

926 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