using System;

using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;

namespace DeviceType
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();

            #if DEBUG
                MinimizeBox = false;
            #else       
                MinimizeBox = true;
            #endif
        }

        [DllImport("coredll.dll")]
        private static extern bool SystemParametersInfo(
        uint uiAction,
        uint uiParam,
        StringBuilder pvParam,
        uint fWinIni);

        const uint SPI_GETPLATFORMTYPE = 257;
        const int bufferSize = 200;
        
        // Определяем тип устройства
        private string GetDeviceType()
        {
            StringBuilder platformType = new StringBuilder(bufferSize);
            SystemParametersInfo(SPI_GETPLATFORMTYPE, bufferSize, platformType, 0);
            string strDeviceType = platformType.ToString();
            string strDeviceInfo = "";

            switch (strDeviceType)
            {
                case "PocketPC":
                    strDeviceInfo = "КПК";
                    break;
                case "SmartPhone":
                    strDeviceInfo = "Смартфон";
                    break;
            }
            return strDeviceInfo;
        }

        private void menuExit_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            txtDeviceType.Text = GetDeviceType();
        }
    }
}