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.
01-12-2005, 04:02 AM
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.SetData LoadPicture("T:\Temp\schedule.gif"), vbCFBitmap ' Get bitmap
SendMessage RichTextBox1.hwnd, WM_PASTE, 0, 0
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: