Form1.cs
上传用户:junrenl
上传日期:2022-04-24
资源大小:11k
文件大小:1k
源码类别:

Windows Mobile

开发平台:

C#

  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Text;
  7. using System.Windows.Forms;
  8. using System.Runtime.InteropServices;
  9. using System.Threading;
  10. namespace Vib
  11. {
  12.     public partial class Form1 : Form
  13.     {
  14.         public struct NLED_SETTINGS_INFO
  15.         {
  16.             public int LedNum;
  17.             public int OffOnBlink;
  18.             public int TotalCycleTime;
  19.             public int OnTime;
  20.             public int MetacycleOn;
  21.             public int MetacycleOff;
  22.         }
  23.         [DllImport("Coredll.dll")]
  24.         public static extern bool NLedSetDevice(int deviceId, ref NLED_SETTINGS_INFO info);
  25.         public Form1()
  26.         {
  27.             InitializeComponent();
  28.         }
  29.         private void button1_Click(object sender, EventArgs e)
  30.         {
  31.             NLED_SETTINGS_INFO info = new NLED_SETTINGS_INFO();
  32.             info.LedNum = 1;
  33.             info.OffOnBlink = 1;
  34.             NLedSetDevice(1, ref info);
  35.         }
  36.         private void button2_Click(object sender, EventArgs e)
  37.         {
  38.             NLED_SETTINGS_INFO info = new NLED_SETTINGS_INFO();
  39.             info.LedNum = 1;
  40.             info.OffOnBlink = 0;
  41.             NLedSetDevice(1, ref info);
  42.             
  43.         }
  44.     }
  45. }