本文介绍了请,如何显示我在记事本中的文本框中插入的文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,我
我是初学者,如何显示文本,请在记事本中的文本框中插入文本

hii, everyone
i''m beginner how to display text i insert in textbox in notepad

推荐答案


[DllImport("user32.dll", EntryPoint = "FindWindowEx")]
    public static extern IntPtr FindWindowEx(IntPtr hwndParent, IntPtr hwndChildAfter, string lpszClass, string lpszWindow);
    [DllImport("User32.dll")]
    public static extern int SendMessage(IntPtr hWnd, int uMsg, int wParam, string lParam);
    private void button1_Click(object sender, EventArgs e)
    {
        Process.Start("notepad.exe", "myfile");
        Process [] notepads=Process.GetProcessesByName("notepad");
        if(notepads.Length==0)return;
        if (notepads[0] != null)
        {
            IntPtr child= FindWindowEx(notepads[0].MainWindowHandle, new IntPtr(0), "Edit", null);
            SendMessage(child, 0x000C, 0, textBox1.Text);
        }
    }


StreamWriter writer = new StreamWriter("C:\\Files\\abc.txt");
     writer.write(textbox1.text);
     writer.dispose()


这篇关于请,如何显示我在记事本中的文本框中插入的文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

11-01 21:49