case IDOK:
HRESULT CheckInstances(){  char  szSection[MAX_BUF];  char  szProcessName[MAX_BUF];  char  szClassName[MAX_BUF];  char  szWindowName[MAX_BUF];  char  szMessage[MAX_BUF];  char  szIndex[MAX_BUF];  int   iIndex;  BOOL  bContinue;  HWND  hwndFW;  LPSTR szWN;  LPSTR szCN;  DWORD dwRv0;  DWORD dwRv1;  bContinue = TRUE;  iIndex    = -1;  while(bContinue)  {    ZeroMemory(szClassName,  sizeof(szClassName));    ZeroMemory(szWindowName, sizeof(szWindowName));    ZeroMemory(szMessage,    sizeof(szMessage));    ++iIndex;    itoa(iIndex, szIndex, 10);    lstrcpy(szSection, "Check Instance");    lstrcat(szSection, szIndex);    GetPrivateProfileString(szSection, "Message", "", szMessage, sizeof(szMessage), szFileIniConfig);    if(GetPrivateProfileString(szSection, "Process Name", "", szProcessName, sizeof(szProcessName), szFileIniConfig) != 0L)    {      if(*szProcessName != '\0')      {        /* If an instance is found, call PreCheckInstance first */        if(CheckForProcess(szProcessName, sizeof(szProcessName)) == TRUE)          PreCheckInstance(szSection, szFileIniConfig);        if(CheckForProcess(szProcessName, sizeof(szProcessName)) == TRUE)        {          if(*szMessage != '\0')          {            switch(sgProduct.dwMode)            {              case NORMAL:                switch(MessageBox(hWndMain, szMessage, NULL, MB_ICONEXCLAMATION | MB_RETRYCANCEL))                {                  case IDCANCEL:                    /* User selected to cancel Setup */                    return(TRUE);                  case IDRETRY:                    /* User selected to retry.  Reset counter */                    iIndex = -1;                    break;                }                break;              case AUTO:                ShowMessage(szMessage, TRUE);                Delay(5);                ShowMessage(szMessage, FALSE);                /* Setup mode is AUTO.  Show message, timeout, then cancel because we can't allow user to continue */                return(TRUE);              case SILENT:                return(TRUE);            }          }          else          {            /* No message to display.  Assume cancel because we can't allow user to continue */            return(TRUE);          }        }      }      /* Process Name= key existed, and has been processed, so continue looking for more */      continue;    }    /* Process Name= key did not exist, so look for other keys */    dwRv0 = GetPrivateProfileString(szSection, "Class Name",  "", szClassName,  sizeof(szClassName), szFileIniConfig);    dwRv1 = GetPrivateProfileString(szSection, "Window Name", "", szWindowName, sizeof(szWindowName), szFileIniConfig);    if((dwRv0 == 0L) &&       (dwRv1 == 0L))    {      bContinue = FALSE;    }    else if((*szClassName != '\0') || (*szWindowName != '\0'))    {      if(*szClassName == '\0')        szCN = NULL;      else        szCN = szClassName;      if(*szWindowName == '\0')        szWN = NULL;      else        szWN = szWindowName;      /* If an instance is found, call PreCheckInstance first */      if((hwndFW = FindWindow(szCN, szWN)) != NULL)        PreCheckInstance(szSection, szFileIniConfig);      if((hwndFW = FindWindow(szCN, szWN)) != NULL)      {        if(*szMessage != '\0')        {          switch(sgProduct.dwMode)          {            case NORMAL:              switch(MessageBox(hWndMain, szMessage, NULL, MB_ICONEXCLAMATION | MB_RETRYCANCEL))              {                case IDCANCEL:                  /* User selected to cancel Setup */                  return(TRUE);                case IDRETRY:                  /* User selected to retry.  Reset counter */                  iIndex = -1;                  break;              }              break;            case AUTO:              ShowMessage(szMessage, TRUE);              Delay(5);              ShowMessage(szMessage, FALSE);              /* Setup mode is AUTO.  Show message, timeout, then cancel because we can't allow user to continue */              return(TRUE);            case SILENT:              return(TRUE);          }        }        else        {          /* No message to display.  Assume cancel because we can't allow user to continue */          return(TRUE);        }      }    }  }  return(FALSE);}