c# GlobalAddAtom GlobalDeleteAtom

  调用:      SendFormMessage(1052176, "213412341234");
        

        [DllImport("kernel32.dll", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Unicode)]
        public static extern int GlobalAddAtom(string lpString);

        [DllImport("kernel32.dll", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Unicode)]
        public static extern int GlobalDeleteAtom(int atom);

        [DllImport("user32.dll", EntryPoint = "SendMessage")]
        private static extern int SendMessage(int hwnd, int wMsg, int wParam, int lParam);

        private static void SendFormMessage(int pHandle, string sText)
        {
            int atom = GlobalAddAtom(sText);
            SendMessage(pHandle, 1025, 0, atom);
            GlobalDeleteAtom(atom);
        }

猜你喜欢

转载自www.cnblogs.com/onlyou13/p/12026106.html
C#
今日推荐