Solved

RichTextBox1.OLEObjects.Add

Posted on 2002-04-15
8
732 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
 
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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
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.
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…

743 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now