[VC#.NET]
using OpenNETCF.Desktop.Communication;
RAPI myrapi;
try
// 连接到设备。
{
myrapi.Connect();
while (! myrapi.DevicePresent)
{
MessageBox.Show("Please connect your device to your PC using ActiveSync and before clicking the OK button.",
"No Device Present");
myrapi.Connect();
}
}