コード例 #1
0
static BOOL OnInitDialog (HWND hwnd, HWND hwndFocus, LPARAM lParam)
{
   LPGRANTPARAMS lpgrant = (LPGRANTPARAMS)lParam;
   HWND hwndGrantees  = GetDlgItem (hwnd, IDC_GRANT_DBEVENT_GRANTEES);
   HWND hwndDBevents  = GetDlgItem (hwnd, IDC_GRANT_DBEVENT_DBEVENT);
   char szTitle [MAX_TITLEBAR_LEN];
   char szFormat[100];
   //
   // force catolist.dll to load
   //
   CATOListDummy();

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

   LoadString (hResource, (UINT)IDS_T_GRANT_DBEVENT, szFormat, sizeof (szFormat));
   wsprintf (szTitle,
       szFormat,
       GetVirtNodeName (GetCurMdiNodeHandle ()),
       lpgrant->DBName);
   SetWindowText (hwnd, szTitle);
   lpHelpStack = StackObject_PUSH (lpHelpStack, StackObject_INIT ((UINT)IDD_GRANT_DBEVENT));

   Button_SetCheck (GetDlgItem (hwnd, IDC_GRANT_DBEVENT_USER), TRUE);
   FillGrantees (hwndGrantees, OT_USER);

   if (!CAListBoxFillDBevents (hwndDBevents, lpgrant->DBName))
       CAListBoxDestroyItemData (hwndDBevents);

   if (lpgrant->PreselectPrivileges [GRANT_RAISE])
       Button_SetCheck (GetDlgItem (hwnd, IDC_GRANT_DBEVENT_RAISE),    TRUE);
   if (lpgrant->PreselectPrivileges [GRANT_REGISTER])
       Button_SetCheck (GetDlgItem (hwnd, IDC_GRANT_DBEVENT_REGISTER), TRUE);

   if (x_strlen (lpgrant->PreselectGrantee) > 0)
       CAListBox_SelectString (hwndGrantees, -1, lpgrant->PreselectGrantee);
   if (x_strlen (lpgrant->PreselectObject) > 0)
       CAListBoxSelectStringWithOwner (hwndDBevents, lpgrant->PreselectObject, lpgrant->PreselectObjectOwner);
   EnableDisableOKButton  (hwnd);
   
   richCenterDialog(hwnd);
   return TRUE;
}
コード例 #2
0
static BOOL OnInitDialog (HWND hwnd, HWND hwndFocus, LPARAM lParam)
{
   LPGRANTPARAMS lpgrant = (LPGRANTPARAMS)lParam;
   HWND    hwndDatabases = GetDlgItem (hwnd, IDC_GNREF_PROCEDURE_DATABASES);
   HWND    hwndGrantees  = GetDlgItem (hwnd, IDC_GNREF_PROCEDURE_GRANTEES);
   HWND    hwndProcedures= GetDlgItem (hwnd, IDC_GNREF_PROCEDURE_PROCEDURES);
   UCHAR   szDatabaseName[MAXOBJECTNAME];
   char    szTitle [MAX_TITLEBAR_LEN];
   char    szFormat[100];

   if (!AllocDlgProp (hwnd, lpgrant))
       return FALSE;
   //
   // force catolist.dll to load
   //
   CATOListDummy();
   if (lpgrant->ObjectType == OT_PROCEDURE)
      LoadString (hResource, (UINT)IDS_T_GNREF_PROCEDURE, szFormat, sizeof (szFormat));
   else
      LoadString (hResource, (UINT)IDS_T_GNREF_SEQUENCE, szFormat, sizeof (szFormat));

   wsprintf (
       szTitle,
       szFormat,
       GetVirtNodeName (GetCurMdiNodeHandle ()));

   SetWindowText (hwnd, szTitle);
   if (lpgrant->ObjectType == OT_PROCEDURE)
      lpHelpStack = StackObject_PUSH (lpHelpStack, StackObject_INIT ((UINT)IDD_GNREF_PROCEDURE));
   else
      lpHelpStack = StackObject_PUSH (lpHelpStack, StackObject_INIT ((UINT)ID_HELPID_GNREF_SEQUENCE));


   if (lpgrant->GranteeType == OT_GROUP)
   {
       Button_SetCheck (GetDlgItem (hwnd, IDC_GNREF_PROCEDURE_GROUP), TRUE);
       FillGrantees (hwndGrantees, lpgrant->GranteeType);
   }
   else
   if (lpgrant->GranteeType == OT_ROLE)
   {
       Button_SetCheck (GetDlgItem (hwnd, IDC_GNREF_PROCEDURE_ROLE),  TRUE);
       FillGrantees (hwndGrantees, lpgrant->GranteeType);
   }
   else
   {
       if  (x_strcmp (lpgrant->PreselectGrantee, lppublicdispstring()) == 0)
           Button_SetCheck (GetDlgItem (hwnd, IDC_GNREF_PROCEDURE_PUBLIC), TRUE);
       else
       {
           Button_SetCheck (GetDlgItem (hwnd, IDC_GNREF_PROCEDURE_USER),   TRUE);
           lpgrant->GranteeType = OT_USER;
           FillGrantees (hwndGrantees, lpgrant->GranteeType);
       }
   }

   ComboBoxFillDatabases  (hwndDatabases);
   ComboBoxSelectFirstStr (hwndDatabases);
   ComboBox_GetText (hwndDatabases, szDatabaseName, sizeof (szDatabaseName));
   x_strcpy (lpgrant->DBName, szDatabaseName);
   
   if (lpgrant->ObjectType == OT_PROCEDURE) {
      if (!CAListBoxFillProcedures (hwndProcedures, szDatabaseName))
         CAListBoxDestroyItemData (hwndProcedures);
   }
   else {
       ShowWindow( GetDlgItem (hwnd,IDC_GNREF_PROCEDURE_OPTION) ,SW_HIDE);// Hided "With grant Option" control
       LoadString (hResource, (UINT)IDS_STATIC_SEQUENCE, szFormat, sizeof (szFormat));
       SetDlgItemText(  hwnd, IDC_STATIC_GNREF_PROCEDURE, szFormat ); 

       if (!CAListBoxFillSequences (hwndProcedures, lpgrant->DBName))
           CAListBoxDestroyItemData (hwndProcedures);
   }

   if (x_strlen (lpgrant->PreselectGrantee) > 1)
      PreselectGrantee (hwndGrantees, lpgrant->PreselectGrantee);
   if (x_strlen (lpgrant->PreselectObject) > 1)
      CAListBoxSelectStringWithOwner (hwndProcedures, lpgrant->PreselectObject, lpgrant->PreselectObjectOwner);
   EnableDisableOKButton (hwnd);

   richCenterDialog(hwnd);
   return TRUE;
}