Type | Description | |||
Boolean | A boolean expression that indicates whether the control displays a Replace dialog when user presses CTRL + H key. |
Use the AllowReplace property to enable Replace support for your control. Use the AllowFind property to enable Find support for your control. Use the Caption property to internationalize the Replace dialog.
The following screen show displays the Replace dialog:
You can invoke any of the following commands: Delete, Copy, Cut, Find, Replace, FindNext, FindPrev, Paste, Select All, Undo and Redo. Each command has an unique identifier like follows:
#define ID_EDIT_REPLACE 0xE129 #define ID_EDIT_DELETE 0xE120 #define ID_EDIT_COPY 0xE122 #define ID_EDIT_CUT 0xE123 #define ID_EDIT_FIND 0xE124 #define ID_EDIT_PASTE 0xE125 #define ID_EDIT_SELECT_ALL 0xE12A #define ID_EDIT_UNDO 0xE12B #define ID_EDIT_REDO 0xE12C #define ID_EDIT_FINDNEXT 0xE12D #define ID_EDIT_FINDPREV 0xE12E #define ID_CODE_COMPLETION 0xEA01 #define ID_EDIT_INCREMENTALSEARCH 0xEA02
For instance, the following VB sample displays the Replace dialog when user clicks a button:
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_COMMAND = &H111 Private Sub Command1_Click() Edit1.SetFocus SendMessage Edit1.hwnd, WM_COMMAND, &HE129 * 65536, 0 End Sub
The wParam parameter of SendMessage API function needs to be Command's Identifier * 65536.
The following C++ sample displays the Replace dialog when the user clicks a button:
void OnButton1() { m_edit.SetFocus(); m_edit.SendMessage( WM_COMMAND, MAKEWPARAM(0, 0xE129), NULL ); }
The following VB.NET displays the Replace dialog when user the clicks a button:
<System.Runtime.InteropServices.DllImport("user32.dll")> _ Public Shared Function SendMessage(ByVal hWnd As Int32, ByVal wMsg As Int32, ByVal wParam As Int32, ByVal lParam As Int32) As Int32 End Function Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click With AxEdit1 .Focus() SendMessage(.hWnd, &H111, &HE129 << 16, 0) End With End Sub
where the DllImport imports definition for SendMessage API function in VB.NET.
The following C# displays the Replace dialog when user the clicks a button:
[System.Runtime.InteropServices.DllImport("user32.dll")] static extern int SendMessage(int hWnd, int wMsg, int wParam, int lParam); private void button1_Click(object sender, EventArgs e) { axEdit1.Focus(); SendMessage(axEdit1.hWnd, 0x111, 0xE129 << 16, 0); }
where the DllImport imports definition for SendMessage API function in C#.
The following VFP displays the Replace dialog when user the clicks a button:
DECLARE INTEGER SendMessage IN user32; INTEGER hWnd,; INTEGER Msg,; INTEGER wParam,; INTEGER lParam with thisform.Edit1.Object SendMessage( .hWnd, 273, BITLSHIFT(57641, 16), 0) endwith