To undo and redo
Code:
Private Const WM_USER As Long = &H400
Private Const EM_UNDO As Long = &HC7
Private Const EM_REDO As Long = (WM_USER + 84)
Private Const EM_CANREDO As Long = (WM_USER + 85)
Private Const EM_CANUNDO As Long = &HC6
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Integer, ByVal lParam As Any) As Long
Private Sub Command1_Click() 'Undo
SendMessage RichTextBox1.hwnd, EM_UNDO, 0, 0&
End Sub
Private Sub Command2_Click() 'Redo
SendMessage RichTextBox1.hwnd, EM_REDO, 0, 0&
End Sub
Private Sub Form_Load()
'Set the command button status'
'This can be replaced by setting command1 and command2, enabled = false ;)
RichTextBox1_Change
End Sub
Private Sub RichTextBox1_Change()
'If we can undo, then make command1 enabled
If SendMessage(RichTextBox1.hwnd, EM_CANUNDO, 0, 0&) <> 0 Then
Command1.Enabled = True
Else
Command1.Enabled = False
End If
'If we can redo, then make command2 enabled
If SendMessage(RichTextBox1.hwnd, EM_CANREDO, 0, 0&) <> 0 Then
Command2.Enabled = True
Else
Command2.Enabled = False
End If
End Sub
What codes do you have for the "Save As" and the "Print" sections so far?