static BOOL OnInitDialog (HWND hwnd, HWND hwndFocus, LPARAM lParam) { LPSTORAGEPARAMS lpstructure = (LPSTORAGEPARAMS)lParam; char szFormat [100]; char szTitle [MAX_TITLEBAR_LEN]; char buffer [MAXOBJECTNAME]; LPUCHAR parentstrings [MAXPLEVEL]; HWND hwndContainer = GetDlgItem (hwnd, IDC_RELOCATE_CONTAINER); if (!AllocDlgProp (hwnd, lpstructure)) return FALSE; parentstrings [0] = lpstructure->DBName; if (lpstructure->nObjectType == OT_TABLE) { LoadString (hResource, (UINT)IDS_T_RELOCATE_TABLE, szFormat, sizeof (szFormat)); GetExactDisplayString ( lpstructure->objectname, lpstructure->objectowner, OT_TABLE, parentstrings, buffer); lpHelpStack = StackObject_PUSH (lpHelpStack, StackObject_INIT ((UINT)IDD_RELOCATE)); } else { LoadString (hResource, (UINT)IDS_T_RELOCATE_INDEX, szFormat, sizeof (szFormat)); GetExactDisplayString ( lpstructure->objectname, lpstructure->objectowner, OT_INDEX, parentstrings, buffer); lpHelpStack = StackObject_PUSH (lpHelpStack, StackObject_INIT ((UINT)IDD_RELOC_IDX)); } wsprintf ( szTitle, szFormat, GetVirtNodeName (GetCurMdiNodeHandle ()), lpstructure->DBName, buffer); SetWindowText (hwnd, szTitle); //DuplicateLocationList (hwnd); InitContainer (hwndContainer, hwnd, 2); ContainerDisableDisplay (hwndContainer); FillAllData (hwnd); ContainerEnableDisplay (hwndContainer, TRUE); richCenterDialog (hwnd); return TRUE; }
BOOL CxDlgUserMod::OnInitDialog() { CDialog::OnInitDialog(); LPUCHAR parent [MAXPLEVEL]; TCHAR buffer [MAXOBJECTNAME]; CString csFormatTitle,csCaption; // // Make up title: GetWindowText(csFormatTitle); parent [0] = (LPUCHAR)(LPTSTR)(LPCTSTR)m_csDBName; parent [1] = NULL; csCaption.Format(csFormatTitle, (LPTSTR)GetVirtNodeName(m_nNodeHandle), (LPCTSTR)m_csDBName); if (!m_csTableName.IsEmpty() && !m_csTableOwner.IsEmpty()) { GetExactDisplayString (m_csTableName, m_csTableOwner, OT_TABLE, parent, buffer); csCaption += buffer; bChooseTableEnable = FALSE; } else bChooseTableEnable = TRUE; SetWindowText(csCaption); if ( bChooseTableEnable ) m_ctrlButtonTables.EnableWindow(FALSE); // Grayed "Tables" button else { m_ctrlButtonTables.ShowWindow(SW_HIDE); // hide button "tables" m_CheckSpecifTbl.ShowWindow(SW_HIDE); // hide checkBox "specify tables" m_ctrlStaticTblName.ShowWindow(SW_SHOW); //Show static "table" m_ctrlStaticTblName.EnableWindow(TRUE) ; //Ungrayed static "table" m_ctrlTblName.ShowWindow(SW_SHOW); //Show edit controle with the table name. m_ctrlTblName.EnableWindow(FALSE); //Grayed edit controle with the table name. m_ctrlTblName.SetWindowText(m_csTableName); } m_lpTblParam.lpTable = NULL; PushHelpId(IDD_USERMOD); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE }
static BOOL OnInitDialog (HWND hwnd, HWND hwndFocus, LPARAM lParam) { LPREVOKEPARAMS lprevoke = (LPREVOKEPARAMS)lParam; HWND hwndGrantees = GetDlgItem (hwnd, IDC_REVOKE_TABLE_GRANTEES); char szTitle [90]; char szStr [MAX_TITLEBAR_LEN]; int i, positive_privilege; BOOL bGrantAll = FALSE; char buffer [MAXOBJECTNAME]; LPUCHAR parentstrings [MAXPLEVEL]; if (!AllocDlgProp (hwnd, lprevoke)) return FALSE; // // force catolist.dll to load // CATOListDummy(); for (i = 0; i < GRANT_MAX_PRIVILEGES; i++) { if (lprevoke->PreselectPrivileges [i]) { positive_privilege = i; break; } } switch (lprevoke->ObjectType) { case OT_TABLE: lpHelpStack = StackObject_PUSH (lpHelpStack, StackObject_INIT ((UINT)IDD_REVOKE_TABLE)); break; case OT_VIEW: lpHelpStack = StackObject_PUSH (lpHelpStack, StackObject_INIT ((UINT)IDD_REVOKE_VIEW)); break; case OT_DBEVENT: lpHelpStack = StackObject_PUSH (lpHelpStack, StackObject_INIT ((UINT)IDD_REVOKE_DBEVENT)); break; case OT_PROCEDURE: lpHelpStack = StackObject_PUSH (lpHelpStack, StackObject_INIT ((UINT)IDD_RVKGPROC)); break; case OT_SEQUENCE: lpHelpStack = StackObject_PUSH (lpHelpStack, StackObject_INIT ((UINT)IDD_RVKGSEQUENCE)); break; } switch (positive_privilege) { case GRANT_SELECT : LoadString (hResource, (UINT)IDS_T_REVOKE_SELECT_ON, szTitle, sizeof (szTitle)); lprevoke->Privileges [GRANT_SELECT] = TRUE; if (lprevoke->ObjectType == OT_TABLE) HaveBeenGranted = OT_TABLEGRANT_SEL_USER; else HaveBeenGranted = OT_VIEWGRANT_SEL_USER; break; case GRANT_INSERT : LoadString (hResource, (UINT)IDS_T_REVOKE_INSERT_ON, szTitle, sizeof (szTitle)); lprevoke->Privileges [GRANT_INSERT] = TRUE; if (lprevoke->ObjectType == OT_TABLE) HaveBeenGranted = OT_TABLEGRANT_INS_USER; else HaveBeenGranted = OT_VIEWGRANT_INS_USER; break; case GRANT_UPDATE : LoadString (hResource, (UINT)IDS_T_REVOKE_UPDATE_ON, szTitle, sizeof (szTitle)); lprevoke->Privileges [GRANT_UPDATE] = TRUE; if (lprevoke->ObjectType == OT_TABLE) HaveBeenGranted = OT_TABLEGRANT_UPD_USER; else HaveBeenGranted = OT_VIEWGRANT_UPD_USER; break; case GRANT_DELETE : LoadString (hResource, (UINT)IDS_T_REVOKE_DELETE_ON, szTitle, sizeof (szTitle)); lprevoke->Privileges [GRANT_DELETE] = TRUE; if (lprevoke->ObjectType == OT_TABLE) HaveBeenGranted = OT_TABLEGRANT_DEL_USER; else HaveBeenGranted = OT_VIEWGRANT_DEL_USER; break; case GRANT_COPY_INTO : LoadString (hResource, (UINT)IDS_T_REVOKE_COPYINTO_ON, szTitle, sizeof (szTitle)); lprevoke->Privileges [GRANT_COPY_INTO] = TRUE; HaveBeenGranted = OT_TABLEGRANT_CPI_USER; break; case GRANT_COPY_FROM : LoadString (hResource, (UINT)IDS_T_REVOKE_COPYFROM_ON, szTitle, sizeof (szTitle)); lprevoke->Privileges [GRANT_COPY_FROM] = TRUE; HaveBeenGranted = OT_TABLEGRANT_CPF_USER; break; case GRANT_REFERENCE : LoadString (hResource, (UINT)IDS_T_REVOKE_REFERENCE_ON, szTitle, sizeof (szTitle)); lprevoke->Privileges [GRANT_REFERENCE] = TRUE; HaveBeenGranted = OT_TABLEGRANT_REF_USER; break; case GRANT_RAISE : LoadString (hResource, (UINT)IDS_T_REVOKE_RAISE_ON, szTitle, sizeof (szTitle)); lprevoke->Privileges [GRANT_RAISE] = TRUE; HaveBeenGranted = OT_DBEGRANT_RAISE_USER; break; case GRANT_REGISTER : LoadString (hResource, (UINT)IDS_T_REVOKE_REGISTER_ON, szTitle, sizeof (szTitle)); lprevoke->Privileges [GRANT_REGISTER] = TRUE; HaveBeenGranted = OT_DBEGRANT_REGTR_USER; break; case GRANT_EXECUTE : LoadString (hResource, (UINT)IDS_T_REVOKE_EXECUTE_ON, szTitle, sizeof (szTitle)); lprevoke->Privileges [GRANT_EXECUTE] = TRUE; HaveBeenGranted = OT_PROCGRANT_EXEC_USER; break; case GRANT_NEXT_SEQUENCE : LoadString (hResource, (UINT)IDS_T_REVOKE_NEXT_SEQUENCE_ON, szTitle, sizeof (szTitle)); lprevoke->Privileges [GRANT_NEXT_SEQUENCE] = TRUE; HaveBeenGranted = OT_SEQUGRANT_NEXT_USER; break; case GRANT_ALL : LoadString (hResource, (UINT)IDS_T_REVOKE_ALL_ON, szTitle, sizeof (szTitle)); lprevoke->Privileges [GRANT_ALL] = TRUE; bGrantAll = TRUE; switch (lprevoke->ObjectType) { case OT_TABLE: break; case OT_PROCEDURE: break; case OT_DBEVENT: break; } HaveBeenGranted = -1; break; } parentstrings [0] = lprevoke->DBName; GetExactDisplayString ( lprevoke->PreselectObject, lprevoke->PreselectObjectOwner, lprevoke->ObjectType, parentstrings, buffer); wsprintf ( szStr, szTitle, GetVirtNodeName ( GetCurMdiNodeHandle ()), lprevoke->DBName, buffer); SetWindowText (hwnd, szStr); if ( lprevoke->ObjectType == OT_SEQUENCE) { //Hide control the controls not used for sequences ShowWindow( GetDlgItem (hwnd,IDC_REVOKE_TABLE_GRANT_OPTION) ,SW_HIDE); // Hided "With grant Option" control ShowWindow( GetDlgItem (hwnd,IDC_REVOKE_TABLE_PRIVILEGE) ,SW_HIDE); ShowWindow( GetDlgItem (hwnd,102) ,SW_HIDE); ShowWindow( GetDlgItem (hwnd,5020) ,SW_HIDE); // Unchecked the controls not used Button_SetCheck (GetDlgItem (hwnd, IDC_REVOKE_TABLE_PRIVILEGE), FALSE); Button_SetCheck (GetDlgItem (hwnd, IDC_REVOKE_TABLE_CASCADE), TRUE); Button_SetCheck (GetDlgItem (hwnd, IDC_REVOKE_TABLE_RESTRICT), FALSE); Button_SetCheck (GetDlgItem (hwnd, IDC_REVOKE_TABLE_GRANT_OPTION), FALSE); } else { Button_SetCheck (GetDlgItem (hwnd, IDC_REVOKE_TABLE_PRIVILEGE),TRUE); Button_SetCheck (GetDlgItem (hwnd, IDC_REVOKE_TABLE_CASCADE), TRUE); } if (lprevoke->GranteeType == OT_UNKNOWN) { HandleUnknounObject (hwnd); } else if (lprevoke->GranteeType == OT_GROUP) { Button_SetCheck (GetDlgItem (hwnd, IDC_REVOKE_TABLE_GROUP), TRUE); FillGrantedUsers(hwndGrantees, lprevoke, HaveBeenGranted); } else if (lprevoke->GranteeType == OT_ROLE) { Button_SetCheck (GetDlgItem (hwnd, IDC_REVOKE_TABLE_ROLE), TRUE); FillGrantedUsers(hwndGrantees, lprevoke, HaveBeenGranted); } else { if (x_strcmp (lprevoke->PreselectGrantee, lppublicdispstring()) == 0) Button_SetCheck (GetDlgItem (hwnd, IDC_REVOKE_TABLE_PUBLIC), TRUE); else { lprevoke->GranteeType = OT_USER; Button_SetCheck (GetDlgItem (hwnd, IDC_REVOKE_TABLE_USER), TRUE); FillGrantedUsers(hwndGrantees, lprevoke, HaveBeenGranted); } } if (x_strlen (lprevoke->PreselectGrantee) > 0) { CAListBox_SelectString (hwndGrantees, -1, lprevoke->PreselectGrantee); } if (lprevoke->GranteeType != OT_UNKNOWN) EnableDisableOKButton (hwnd); richCenterDialog(hwnd); return TRUE; }
///////////////////////////////////////////////////////////////////////////// // CxDlgObjectComment message handlers BOOL CxDlgObjectComment::OnInitDialog() { CDialog::OnInitDialog(); LPUCHAR parent [MAXPLEVEL]; TCHAR buffer [MAXOBJECTNAME]; CString csFormatTitle,csCaption; // // Make up title: GetWindowText(csFormatTitle); parent [0] = (LPUCHAR)(LPTSTR)(LPCTSTR)m_csDBName; parent [1] = NULL; GetExactDisplayString (m_csObjectName, m_csObjectOwner, m_iCurObjType, parent, buffer); csCaption.Format(csFormatTitle,(LPTSTR)GetVirtNodeName(m_nNodeHandle),m_csDBName,buffer); SetWindowText(csCaption); m_ImageList.Create(1, 18, TRUE, 1, 0); m_cListCtrl.SetImageList (&m_ImageList, LVSIL_SMALL); m_cListCtrl.SetFullRowSelected (TRUE); // TODO: Add extra initialization here LV_COLUMN lvcolumn; TCHAR szColHeader [2][16]; lstrcpy(szColHeader [0],VDBA_MfcResourceString(IDS_TC_COLUMN)); // _T("Column") lstrcpy(szColHeader [1],VDBA_MfcResourceString(IDS_TC_COLUMN_COMMENT)); // _T("Comment") int i; int hWidth [2] = {130, 180}; CRect r; // calculate the width of column "comment" m_cListCtrl.GetClientRect(r); hWidth [1] = r.right-hWidth [0]; // // Set the number of columns: 2 // List of columns of Base Object (table or view): memset (&lvcolumn, 0, sizeof (LV_COLUMN)); lvcolumn.mask = LVCF_FMT|LVCF_SUBITEM|LVCF_TEXT|LVCF_WIDTH; for (i=0; i<2; i++) { lvcolumn.fmt = LVCFMT_LEFT; lvcolumn.pszText = szColHeader[i]; lvcolumn.iSubItem = i; lvcolumn.cx = hWidth[i]; m_cListCtrl.InsertColumn (i, &lvcolumn); } if (!InitializeObjectColumns() || !m_ListColumn) { EndDialog(FALSE); return TRUE; } if (!FillListColumnWithComment( )) { EndDialog(FALSE); return TRUE; } LPOBJECTLIST ls; LPCOMMENTCOLUMN lpCol; int nCount = 0; CString csComment; ls = m_ListColumn; while (ls) { lpCol=(LPCOMMENTCOLUMN)ls->lpObject; m_cListCtrl.InsertItem (nCount, (LPCTSTR)lpCol->szColumnName); if (lpCol->lpszComment) m_cListCtrl.SetItemText (nCount, 1,(LPCTSTR)lpCol->lpszComment); nCount++; ls=(LPOBJECTLIST)ls->lpNext; } m_cListCtrl.SetLimitEditText(); m_cEditTableComment.LimitText (MAX_LENGTH_COMMENT); m_cEditTableComment.SetWindowText(m_csCommentObject); m_bEditUnselected = TRUE; PushHelpId(IDD_XOBJECT_COMMENT); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE }