Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

richedit problem 1

Status
Not open for further replies.

topcat1a

Programmer
Jan 6, 2005
34
GB
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:

Code:
RichTextBox1.OLEObjects.Add , , CommonDialog1.fileName

I have no idea.
 
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
 
Could you explain to me what it is doing please? I've spent nearly two weeks looking for a solution thank you very very much :)
 
topcat1a,

I am glad I was able to help you. I understand this code as manipulation with the memory via the Clipboard object. First, clear it to prepare the room, second - send some data nto the memory. In this case, we send some image so we let it know to PC with the vbCFBitmap parameter of the LoadPicture method. Finally, we utilize common API SendMessage function to PASTE the content of the Clipboard into the box. It is my broad understanding. Somebody would probably better explain it.

vladk

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top