C#用API可以改程序名字

[DllImport("user32.dll", EntryPoint = "FindWindow")]
        public static extern int FindWindow(
            string lpClassName,
            string lpWindowName
        );

[DllImport("user32.dll", EntryPoint = "SendMessage")]
        public static extern int SendMessage(
            int hwnd,
            int wMsg,
            IntPtr wParam,
            string lParam
        );
        public const int WM_SETTEXT = 0xC;

int hwnd = FindWindow(null, "无标题 - 记事本");
            string s = "要修改的名字";
            if (hwnd != 0)
            {
                SendMessage(hwnd, WM_SETTEXT, IntPtr.Zero, s);
            }
            else
            {
                MessageBox.Show("记事本没有运行");
            }

原文地址:http://www.2cto.com/kf/201007/52978.html

posted @ 2013-11-15 14:13  Micmacs  阅读(332)  评论(0编辑  收藏  举报