I'd like to work with WLAN in my EVB program, and I heard that there are
a driver to do this: NDIS, but I can find any information about this, an
d how to use it with the Embedded Visual Basic...
Code snippets are highly appreciated.
Please reply to the group.
Thanks in advance.
Ricardo Mtz.
What, specifically, do you want to do over the WLAN on your device (and what
kind of device is it: Pocket PC, Pocket PC 2002, Pocket PC 2003, something
else?)?
Paul T.
"mtz" <rmar...@hotpop.com> wrote in message
news:Oi6RP91j...@tk2msftngp13.phx.gbl...
I need to get wlan signal strenght and various other information from
the WLAN. And I'd like to change the IP address for the WLAN.
Thanks a lot.
Ricardo mtz.
// GetSignalStrength based on the function of the same name in the NETUI
// driver in CE.NET 4.2.
HRESULT GetSignalStrength( TCHAR *ptcDeviceName, INT* piSignalStrength )
{
PNDISUIO_QUERY_OID queryOID;
DWORD dwBytesReturned = 0;
UCHAR QueryBuffer[sizeof(NDISUIO_QUERY_OID)+sizeof(DWORD)];
HANDLE ndisAccess = INVALID_HANDLE_VALUE;
BOOL retval;
HRESULT hr;
// Attach to NDISUIO.
ndisAccess = CreateFile( NDISUIO_DEVICE_NAME, 0, 0, NULL, OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL | FILE_FLAG_OVERLAPPED, INVALID_HANDLE_VALUE );
if ( ndisAccess == INVALID_HANDLE_VALUE )
return E_FAIL; // ????
// Get Signal strength
queryOID = (PNDISUIO_QUERY_OID)&QueryBuffer[0];
queryOID->ptcDeviceName = ptcDeviceName;
queryOID->Oid = OID_802_11_RSSI;
retval = DeviceIoControl( ndisAccess,
IOCTL_NDISUIO_QUERY_OID_VALUE,
(LPVOID) queryOID,
sizeof(NDISUIO_QUERY_OID) + sizeof(DWORD),
(LPVOID) queryOID,
sizeof(NDISUIO_QUERY_OID) + sizeof(DWORD),
&dwBytesReturned,
NULL);
if( retval && piSignalStrength )
{
hr = S_OK;
*piSignalStrength = *(DWORD *)&queryOID->Data;
}
else
{
hr = E_FAIL;
}
CloseHandle( ndisAccess );
return hr;
}
It takes the device name and returns the strength in dB. You can find a
list of device names by calling GetAdaptersInfo() (in the IPHLPAPI, if
available on your device), and select one to pass to the GetSignalStrength()
function.
You have two reasonable options: learn C/C++ and actually write your program
in that environment, or learn enough C/C++ to build a DLL which exports a
function to get the signal strength (or other information), for your eVB
program and call the DLL functions from your eVB program. I don't see much
going for eVB, anyway, so I'd suggest that switching to C is your best
long-term solution...
Paul T.
"mtz" <rmar...@hotpop.com> wrote in message
news:e2UKxT%23jDH...@TK2MSFTNGP10.phx.gbl...