Append Text to Notepad programatically
-
To write to Notepad from c# without creating a file I found the following code. I need this because I dont have write permission on the client but I need to show the extracted data in the Notepad. Private Declare Ansi Function SendMessage Lib "user32.dll" Alias "SendMessageA" (ByVal hwnd As Integer, ByVal wMsg As Integer, ByVal wParam As Integer, ByVal lParam As String) As Integer Private Declare Function FindWindow Lib "user32.dll" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Integer Private Declare Function FindWindowEx Lib "user32.dll" Alias "FindWindowExA" (ByVal hWnd1 As Int32, ByVal hWnd2 As Int32, ByVal lpsz1 As String, ByVal lpsz2 As String) As Int32 Private Const WM_SETTEXT As Integer = &HC Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim hwnd As Integer = FindWindow(vbNullString, "Untitled - Notepad") '/// assuming you have notepad open. Dim x As Integer = FindWindowEx(hwnd, 0, "Edit", vbNullString) Dim strText As String = "some text" If Not x = 0 Then SendMessage(x, WM_SETTEXT, 256, strText) End If End Sub My question is: Is there a way to append text to notepad instead of WM_SETTEXT. I need this because sometimes the data to be extracted is huge and WM_SETTEXT may not suffice. Live Life King Size Alomgir Miah