{Picture in RTB}Help

TopCat
01-05-2005, 04:31 AM
I'm inserting a picture into a richtext box, when it inserts paint opens. Does anyone know how to stop paint from opening when a picture is inserted?

here is the code:


RichTextBox1.OLEObjects.Add , , CommonDialog1.fileName


I have no idea.

TopCat
01-12-2005, 04:02 AM
Found solution:


Private Declare Function SendMessage _
Lib "user32" Alias "SendMessageA" _
(ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Const WM_PASTE = &H302

Private Sub Command1_Click()

Clipboard.Clear
Clipboard.SetData LoadPicture("T:\Temp\schedule.gif"), vbCFBitmap ' Get bitmap
SendMessage RichTextBox1.hwnd, WM_PASTE, 0, 0

End Sub

John
01-12-2005, 06:39 AM
Keep in mind that the clipboard is shared throughout the system. If the user has something important there and you just wipe it out because it makes your life easier then your users will not be very pleased I'm sure. One of the most annoying "bugs" in VB6 is that it wipes out the clipboard when it starts up.

For the "real" solution look here:
http://www.elitevb.com/content/01,0057,01/

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum