How to open text in Notepad from .NET?

前端 未结 4 1774
太阳男子
太阳男子 2020-12-08 20:38

When I click a button on a Windows Forms form, I would like to open a Notepad window containing the text from a TextBox control on the form.

How can I do that?

4条回答
  •  有刺的猬
    2020-12-08 21:07

    For non ASCII user.

    [DllImport("User32.dll", EntryPoint = "SendMessage", CharSet = CharSet.Unicode)]
    private static extern int SendMessage(IntPtr hWnd, int uMsg, int wParam, string lParam);
    

    Based on @Peter Mortensen answer

    Add CharSet = CharSet.Unicode to the attribute for supporting Unicode characters

提交回复
热议问题