⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mymsgwindow.cs

📁 windows ce 程序设计书 的源代码
💻 CS
字号:
using System;
using System.Text;
using System.Runtime.InteropServices;
using Microsoft.WindowsCE.Forms;

namespace MySquirtCF
{
    /// <summary>
    /// Summary description for MyMsgWindow.
    /// </summary>
    public class MyMsgWindow : MessageWindow
    {
        public MyMsgWindow()
        {
            //
            // TODO: Add constructor logic here
            //
        }
        public string Text 
        {
            get 
            {
                StringBuilder sbText = new StringBuilder (256);
                GetWindowText (this.Hwnd, sbText, sbText.Capacity);
                return sbText.ToString();
            }
            set 
            {
                SetWindowText (this.Hwnd, value);
            }
        }
        public static IntPtr FindOtherWindow (string strTitle) 
        {
            return FindWindow (null, strTitle);
        }
        protected override void WndProc(ref Message m)
        {
            base.WndProc (ref m);
        }

        /// <summary>
        /// Returns true when running on a Pocket PC
        /// </summary>
        /// <returns></returns>
        public static bool IsPocketPC () 
        {
            bool fPocketPC = false;
            StringBuilder sb = new StringBuilder (256);
            PrivGetPlatString (257, sb.Capacity, sb, 0);
            string strPlat = sb.ToString();
            if (strPlat == "PocketPC")
                fPocketPC = true;
            return fPocketPC;
        }
        // Used by IsPocketPC routine to get the platform string
        [DllImport ("Coredll.dll", EntryPoint="SystemParametersInfoW")]
        private static extern bool PrivGetPlatString (int Cmd, 
            int StrLen, StringBuilder strPlat, int fWinIni);

        [DllImport ("coredll.dll", EntryPoint="FindWindowW")]
        private static extern IntPtr FindWindow (string strClass, 
                                                 string strTitle);
        
        [DllImport ("coredll.dll", EntryPoint="SetWindowTextW")]
        private static extern void SetWindowText (IntPtr h, string s);

        [ DllImport( "coredll.dll", EntryPoint="GetWindowTextW")]
        public static extern int GetWindowText (IntPtr h, 
                              StringBuilder sysDirBuffer, int size );

    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -