After some checking Peter and I have found that the native value that we use for the
LastSeen property doesn't return what it is documented to return! It always just returns the time when the discovery was completed(?), we checked both XP SP2 and Vista. So this property sadly isn't useful to find whether a particular device is in range.
As evidence.. The new SdpBrowserDesktop sample displays information on discovery as follows. The two devices listed there are not in range, they are in fact both turned off, but it reports LastSeen as a time after the discovery started.
Discovery process started at 05/14/2007 11:01:46 UTC, 05/14/2007 12:01:46 local
* FooBar1
Address: 000999011B99
Remembered: True, Authenticated: True, Connected: False
LastSeen: 05/14/2007 11:01:56, LastUsed: 01/01/0001 00:00:00
CoD: (0x00020114)
Device: PdaComputer (0x00000114)
Service: Network (0x00000010)
* FooBar2
Address: 000999686599
Remembered: True, Authenticated: True, Connected: False
LastSeen: 05/14/2007 11:01:56, LastUsed: 01/01/0001 00:00:00
CoD: (0x00720104)
Device: DesktopComputer (0x00000104)
Service: Network, ObjectTransfer, Audio, Telephony (0x00000390)
As evidence that it is the native method which is wrong, when I go to the Windows Bluetooth Control panel and view the Device Properties dialog for the first of those devices it reports:
Last connected: 14 May 2007 at 12:07:51
So that gets it wrong too, presumably using the same value...
This is not how it is described in MSDN... At http://msdn2.microsoft.com/en-us/library/aa362924.aspx it says:
stLastSeen
Last time the device was seen, in the form of a SYSTEMTIME structure.
Alan J. McFarlane
http://www.alanjmcf.me.uk/
Please follow-up in the newsgroup for the benefit of all.
Have I helped? Consider visiting my Amazon wishlist, see my homepage.