• Congratulations to the Class of 2024 on your results!
    Let us know how you went here
    Got a question about your uni preferences? Ask us here

Emotions in RTB? (1 Viewer)

sunny

meh.
Joined
Jul 7, 2002
Messages
5,350
Gender
Male
HSC
2002
The chances are they are not using a RTB, or even coded MSN with VB in the first place.

The closest I know of with the RTB is to insert a picture into the RTB as an OLE object.

Something like:
Code:
RTB.OLEObjects.Add , "this is a pic", "C:\test.bmp"
will insert the bitmap into the RTB.
 

sunny

meh.
Joined
Jul 7, 2002
Messages
5,350
Gender
Male
HSC
2002
That sure is some impressive code there! Its a great idea to work backwards and get the rtf code needed for an image instead of putting the image directly in.

The "this is a pic" isn't really needed. Its an optional argument to the Add method, it just lets you refer back to the OLEObject using this name. Like the article said using OLE objects is a pretty mediocre way of doing it - and its referring to how you can edit the thing if you clicked on it :p

You might want to try this and see if it works well enough for you. The idea is to lock the form before it gets updated so that the while the menu is being drawn on, the form doesn't get updated and you move the cursor away from the OLE object then unlock the form again - presto! Then it should look like that nothing has happened, though it might be abit slow.

Code:
Option Explicit

' this is the API declaration to lock the form
Private Declare Function LockWindowUpdate Lib "user32" (ByVal hwndLock As Long) As Long

Private Sub Command1_Click()

    ' lock this form
    LockWindowUpdate Me.hWnd
    ' add the picture
    rtb.OLEObjects.Add , , "c:\test.bmp"
    ' unselect the picture by moving the cursor to the end
    rtb.SelStart = Len(rtb.Text)
    ' unlock the window
    LockWindowUpdate False
    
End Sub
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Top