Beispiel #1
0
static BOOL OnInitDialog (HWND hwnd, HWND hwndFocus, LPARAM lParam)
{
   LPSECURITYALARMPARAMS lpsecurity   = (LPSECURITYALARMPARAMS)lParam;
   HWND    hwndUsers    = GetDlgItem (hwnd, IDC_REFALARM_BYUSER  );
   HWND    hwndDatabase = GetDlgItem (hwnd, IDC_REFALARM_DATABASE);
   HWND    hwndTables   = GetDlgItem (hwnd, IDC_REFALARM_ONTABLE );
   char    szTitle  [MAX_TITLEBAR_LEN];
   char    szFormat [100];
   char    szDatabaseName [MAXOBJECTNAME];

   if (!AllocDlgProp (hwnd, lpsecurity))
       return FALSE;
   //
   // force catolist.dll to load
   //
   CATOListDummy();

   LoadString (hResource, (UINT)IDS_T_CREATE_SECURITY, szFormat, sizeof (szFormat));

   wsprintf (szTitle, szFormat,
       GetVirtNodeName ( GetCurMdiNodeHandle ()),
       lpsecurity->DBName);
   SetWindowText (hwnd, szTitle);
   lpHelpStack = StackObject_PUSH (lpHelpStack, StackObject_INIT ((UINT)IDD_REFALARM));

   //
   // Get the available database names and insert them into the combo box
   //
   ComboBoxFillDatabases (hwndDatabase);
   ComboBoxSelectFirstStr(hwndDatabase);
   ComboBox_GetText (hwndDatabase, szDatabaseName, sizeof (szDatabaseName));
   if (x_strlen (szDatabaseName) > 0)
       x_strcpy (lpsecurity->DBName, szDatabaseName);

   //
   // Get the available table names and insert them into the table list 
   //
   if (x_strlen (lpsecurity->DBName) > 0)
   {
       if (!CAListBoxFillTables (hwndTables, lpsecurity->DBName, FALSE))
       {
           CAListBoxDestroyItemData (hwndTables);
           return FALSE;
       }
   }
   //
   // Get the available users names and insert them into the CA list box 
   // 

   CAListBoxFillUsersP (hwndUsers);
   PreCheckItem (hwnd);
   EnableDisableOKButton (hwnd);

   richCenterDialog (hwnd);
   return TRUE;
}
Beispiel #2
0
static BOOL OnInitDialog (HWND hwnd, HWND hwndFocus, LPARAM lParam)
{

   LPSECURITYALARMPARAMS lpsecurity   = (LPSECURITYALARMPARAMS)lParam;
   HWND hwndUsers    = GetDlgItem (hwnd, IDC_SALARM_BYUSER );
   HWND hwndDB       = GetDlgItem (hwnd, IDC_SALARM_ONTABLE);
   HWND hwndDBE      = GetDlgItem (hwnd, IDC_SALARM_DBEVENT);
   HWND hwndCaptionDB= GetDlgItem (hwnd, IDC_SALARM_STATIC_DB);

   char szFormat [100];
   char szTitle  [180];

   if (!AllocDlgProp (hwnd, lpsecurity))
       return FALSE;

   bNoDisplayMessageDB = FALSE;
   //
   // force catolist.dll to load
   //
   CATOListDummy();

   if (lpsecurity->bInstallLevel) {
      SetWindowText (hwndCaptionDB, "On:");
      //"Create Security Alarm on Current Installation on %s"
      wsprintf (szTitle, ResourceString(IDS_F_CREATE_SECURITY),
                GetVirtNodeName ( GetCurMdiNodeHandle ()));
   }
   else {
      LoadString (hResource, (UINT)IDS_T_CREATE_SECURITY, szFormat, sizeof (szFormat));
      wsprintf (szTitle, szFormat,
                GetVirtNodeName ( GetCurMdiNodeHandle ()),
                lpsecurity->DBName);

   }


   
   SetWindowText (hwnd, szTitle);

   Edit_LimitText (GetDlgItem (hwnd, IDC_SALARM_DBEVENT_TEXT), MAXOBJECTNAME-1);
   ZEROINIT (szSecurityDBEvent);
   LoadString (hResource, (UINT)IDS_I_NODBEVENT, szSecurityDBEvent, sizeof (szSecurityDBEvent));

   //
   // Set the default to user
   //
   Button_SetCheck (GetDlgItem (hwnd, IDC_SALARM_USER), TRUE);

   //
   // Get the available users names and insert them into the CA list box 
   // 

   CAListBoxFillUsers (hwndUsers);

   //
   // Get the available DB names and insert them into the table list 
   // 
   if (lpsecurity->bInstallLevel) {
       char * pcurinst = ResourceString(IDS_CURRENT_INSTALLATION);
       CAListBox_AddString   (hwndDB,pcurinst);
       CAListBox_SelectString(hwndDB,-1,pcurinst);
       lpsecurity->iObjectType = OT_VIRTNODE;
       EnableWindow(hwndDB,FALSE);
       EnableWindow(hwndDBE,FALSE);
   }
   else  {
       CAListBoxFillDatabases (hwndDB);
       lpsecurity->iObjectType = OT_DATABASE;
   }

   if (!lpsecurity->bInstallLevel &&
       !ComboBoxFillDBevents (hwndDBE, "iidbdb"))
   {
       ComboBoxDestroyItemData (hwndDBE);
       return FALSE;
   }

   {
       int   k;
       char* buffowner;

       k = ComboBox_AddString (hwndDBE, szSecurityDBEvent);
       buffowner = ESL_AllocMem (x_strlen (szSecurityDBEvent) +1);
       x_strcpy (buffowner, szSecurityDBEvent);
       ComboBox_SetItemData (hwndDBE, k, buffowner);
       ComboBox_SelectString(hwndDBE, -1, szSecurityDBEvent);
       EnableControl (hwnd, FALSE);
   }

   PreCheckItem (hwnd);
   EnableDisableOKButton (hwnd);
   //
   // The value 9039 is defined in MAINMFC.H but is not accessible from this file:
   lpHelpStack = StackObject_PUSH (lpHelpStack, StackObject_INIT (lpsecurity->bInstallLevel? 9039: (UINT)IDD_SECURITY_ALARM2));

   richCenterDialog (hwnd);
   return TRUE;
}