Examples of CEUTIL Functions

The following code example shows how to enumerate device partnerships and get file sync folder path.

HCESVC   hsvc            = NULL;
HCESVC   hsvcSync        = NULL;
HCESVC   hsvcProfile     = NULL;
DWORD    cProfilesEnum   = 0;
DWORD    nProfileID      = 0;

while (SUCCEEDED (CeSvcEnumProfiles(&hsvc, cProfilesEnum, &nProfileID)))
{
   if (nProfileID != (DWORD)-1)
   {
      if (SUCCEEDED(CeSvcOpenEx(hsvcProfile, TEXT("Services\\Synchronization"), FALSE, &hsvcSync)))
         {
            TCHAR szPath[MAX_PATH];
            if (SUCCEEDED(CeSvcGetString(hsvcSync, TEXT("Briefcase Path"), szPath, sizeof(szPath)/sizeof(TCHAR))))
            {
               //complete tasks
            }
            CeSvcClose(hsvcSync);
         }
         CeSvcClose(hsvcProfile);
      }
   }
   cProfilesEnum++;
}

The following code example shows how to add a custom menu.

HCESVC    hsvcMyMenu = NULL;

if (SUCCEEDED(CeSvcOpen(CESVC_CUSTOM_MENUS, TEXT("MyApp"), TRUE, &hsvcMyMenu)))
{
   CeSVCSetString(hsvcMyMenu, TEXT("DisplayName"), TEXT("&My Calculator"));
   CeSVCSetString(hsvcMyMenu, TEXT("Command"), TEXT("calc.exe"));
   CeSVCSetString(hsvcMyMenu, TEXT("StatusHelp"), TEXT("Displays calculator"));
   CeSVCSetString(hsvcMyMenu, TEXT("Version"), 0x00020000);
   CeSvcClose(hsvcMyMenu);
}