Motorola SYMBOL MINISCAN MSXX04 Guía de usuario Pagina 250

  • Descarga
  • Añadir a mis manuales
  • Imprimir
  • Pagina
    / 278
  • Tabla de contenidos
  • MARCADORES
  • Valorado. / 5. Basado en revisión del cliente
Vista de pagina 249
Chapter 20: Registry-based WWAN API
Sample Source Code
Psion Mobile Devices Developers Guide
238
REG_NOTIFY_CHANGE_LAST_SET);
if (regEvent == INVALID_HANDLE_VALUE)
{
// can't set up notification
RegCloseKey(key);
return 1;
}
while (true)
{
DWORD bytesAvailable, bytesReturned;
BYTE * infoBuf = 0;
BYTE * infoBufPtr;
REG_NOTIFY_INFORMATION const * regNotify;
if (WaitForSingleObject(regEvent, INFINITE) != WAIT_OBJECT_0)
{
// wait failed
break;
}
if (CeRegGetNotificationInfo(regEvent, 0, 0, 0, &bytesReturned, &bytesAvailable) !=
ERROR_SUCCESS)
{
// no notification info size
continue;
}
if (bytesAvailable == 0)
{
// notification info size: 0
continue;
}
infoBuf = new BYTE[bytesAvailable];
memset(infoBuf, 0, bytesAvailable);
if (CeRegGetNotificationInfo(regEvent, 0, infoBuf, bytesAvailable, &bytesReturned,
&bytesAvailable) != ERROR_SUCCESS)
{
// no notification info buffer
delete[] infoBuf;
infoBuf = 0;
continue;
}
infoBufPtr = infoBuf;
do
{
WCHAR valueName[MAX_PATH];
regNotify = reinterpret_cast(infoBufPtr);
if (regNotify->RegNameLength == 0)
{
// value name length: 0
break;
}
if (bytesReturned < regNotify->RegNameLength + sizeof(REG_NOTIFY_INFORMATION) -
sizeof(WCHAR))
{
// not enough data left
break;
}
memcpy(valueName,
regNotify->RegName,
regNotify->RegNameLength);
valueName[regNotify->RegNameLength / sizeof(WCHAR)] = L'\0';
if (regNotify->Action == FILE_ACTION_REMOVED)
{
// Handle the removal of valueName here
}
else if (regNotify->Action == FILE_ACTION_ADDED ||
regNotify->Action == FILE_ACTION_MODIFIED)
{
DWORD type, size;
if (RegQueryValueEx(key, valueName, 0, 0, 0, &size) == ERROR_SUCCESS)
{
Vista de pagina 249
1 2 ... 245 246 247 248 249 250 251 252 253 254 255 ... 277 278

Comentarios a estos manuales

Sin comentarios