Bu dersimizde bir not defterinin adını değiştirme ve içerik girmeyi öğrenelim..
2 adet groupbox
4 adet textbox
2 adet button
Textbox1 ve 2'nin Properties özelliklerinden textaligin özelliğini center yapalım.
Kod:
2 adet groupbox
4 adet textbox
2 adet button
Textbox1 ve 2'nin Properties özelliklerinden textaligin özelliğini center yapalım.
Kod:
Kod:
Public Class Form1 Private Declare Function FindWindow Lib "user32.dll" Alias "FindWindowA" (ByVal ipClassName As String, ByVal ipWindowName As String) As Integer Private Declare Function FindWindowEx Lib "user32.dll" Alias "FindWindowExA" (ByVal hWndParent As Integer, ByVal hWndChildAfter As Integer, ByVal ipszClass As String, ByVal ipszWindow As String) As Integer Private Declare Function SendMessage Lib "user32.dll" Alias "SendMessageA" (ByVal hwnd As Integer, ByVal wMsg As Integer, ByVal wParam As Integer, ByVal IParam As String) As Integer Private Const WM_SETTEXT As Integer = &HC Private hwnd As IntPtr Private f As IntPtr Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click hwnd = FindWindow(vbNullString, TextBox1.Text) SendMessage(hwnd, WM_SETTEXT, 0, TextBox2.Text) TextBox3.Text = TextBox2.Text End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click hwnd = FindWindow(vbNullString, TextBox3.Text) f = FindWindowEx(hwnd, 0, "Edit", vbNullString) SendMessage(f, WM_SETTEXT, 0, TextBox4.Text) End Sub End Class
Son düzenleme: