View Single Post
Old 03-13-07, 05:54 PM   #3 (permalink)
dtsouers
Aximsite Minor League
 
dtsouers's Avatar
 
Join Date: Mar 2006
Location: Ohio
Posts: 148
Device: HTC Touch Pro2
Carrier: ATT
Thanked 0 Times in 0 Posts

Awards Showcase
Aximsite Silver Contributors 
Total Awards: 1

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.
Organize your shortcuts en masse.

Last edited by dtsouers; 03-13-07 at 06:12 PM. Reason: added additional method
dtsouers is offline   Reply With Quote