프로그래밍언어/VB.NET

메모장에 텍스트 보내기

부산딸랑이 2013. 2. 16. 15:24

Imports System.Windows.Forms

Public Class Form1
    Private Declare Function FindWindow Lib "user32.dll" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Int32
    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 Declare Function SendMessage Lib "user32.dll" Alias "SendMessageA" (ByVal hwnd As Int32, ByVal wMsg As Int32, ByVal wParam As Int32, ByVal lParam As String) As Long
   


    Private Const WM_SETTEXT As Int32 = &HC

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim hNote As Integer = FindWindow("Notepad", Nothing)
        Dim hNoteEdit As Integer = FindWindowEx(hNote, 0, "Edit", "")

    

        SendMessage(hNoteEdit, WM_SETTEXT, 0, "테스트중이에요 뿌잉뿌잉")

 

 

    End Sub
End Class