|
Here is some snippets in c#:
//Add reference to ceutil in c:\windows\system32\ceutil.dll
[DllImport("CEUTIL.DLL", SetLastError = true)]
private static extern int CeGetDeviceId();
//------------------------------------------------------------------------------------
// Function: IsDeviceConnected()
// Desc: Returns true, if a device is connected. Devices with Guest are considered
// Receives: nada
// Returns: bool
//------------------------------------------------------------------------------------
public static bool IsDeviceConnected()
{
int b = CeGetDeviceId();
switch (b)
{
//Guest value
case -1:
return true;
//No device
case 0:
return false;
//Real device
default:
return true;
}
}
Or if you are using OpenNETCF:
RAPI r = new RAPI();
r.Connect(true);
// make sure we're connected
if (!r.Connected)
{
r.Dispose();
General.ShowErrorMessage("Device not connected. Please connect it and try again.");
return;
}
__________________
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts. To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Last edited by dtsouers; 03-13-07 at 06:12 PM.
Reason: added additional method
|