Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

RichTextBox1.OLEObjects.Add

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

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!

Question has a verified solution.

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

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
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 utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses

704 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