在自动化测试的过程中有时会调用ActiveSyncStart()和ActiveSyncStop()
两个函数在c#的程序中其实很容易实现其功能代码如下:
using Microsoft.WindowsMobile;
namespace ac
{
public partial class Form1 : Form
{
[DllImport("actsyncc.dll", SetLastError = true)]
public static extern void ActiveSyncStart();
[DllImport("actsyncc.dll", SetLastError = true)]
public static extern void ActiveSyncStop();
[DllImport("user32.dll", SetLastError = true)]
public static extern int ExitWindowsEx(int uFlags, int dwReserved);
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
ActiveSyncStart();
}
private void button2_Click(object sender, EventArgs e)
{
ActiveSyncStop();
}
private void button3_Click(object sender, EventArgs e)
{
ExitWindowsEx(0,0);
//ExitwindowsEx(0,1);
//ExitwindowsEx(1,0);
//ExitwindowsEx(1, 1);
}
}
}
浙公网安备 33010602011771号