Автор работы: Пользователь скрыл имя, 03 Сентября 2014 в 19:41, курсовая работа
Целью курсового проекта является закрепление и обобщение знаний, полученных при изучении теоретического курса, приобретение практических навыков по программированию задач на объектно - ориентированном языке Visual C++ в среде разработки Visual Studio 2005 по дисциплине «Технологии и методы программирования».
CString str = "";
if (i == 0) {
str = "detail.dat";
}
else {
str = "act.dat";
}
CFile file(str, CFile::modeRead|CFile::
DWORD nom;
nom = file.GetLength();
if (i == 0) {
nom = nom / 40;
CDetail base;
}
else {
nom = nom / 30;
CAct base;
}
file.Close();
i = 0;
do
{
base.ChtenieZap(i);
index[i].nomer = i;
index[i].kluch = base.num;
i++;
}
while (i < nom);
i = 0;
while (i < nom)
{
if (index[i].kluch != "")
{
if (kl == index[i].kluch)
{
nomer = index[i].nomer;
return(i);
}
}
i++;
}
return(-1);
}
void CIndex::cor_ind(int i,CString kl)
{
index[i].kluch=kl;
return;
}
Файл кодов Index.h
#ifndef index_hpp
#define index_hpp
#include <string.h>
const int max_mass=1000;
class CIndex //определение базового класса
{
public:
int kol;
int fact_kol;
struct tip_index
{
CString kluch;
int nomer;
} index[max_mass];
public:
CIndex();
~CIndex();
int razm_zap;
void init_ind(int,CString);
void init_kol(int);
int dob_ind(CString);
int poisk_ind(CString,int,int&);
void cor_ind(int,CString);
};
#endif
Файл кодов MainFrm.cpp
// MainFrm.cpp : implementation of the CMainFrame class
//
#include "stdafx.h"
#include "1.h"
#include "MainFrm.h"
#include "FilesDlg.h"
#include "ActAddDlg.h"
#include "ActViewDlg.h"
#include "ActSearchDlg.h"
#include "DetailAddDlg.h"
#include "DetailViewDlg.h"
#include "DetailSearchDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
// CMainFrame
IMPLEMENT_DYNAMIC(CMainFrame, CMDIFrameWndEx)
const int iMaxUserToolbars = 10;
const UINT uiFirstUserToolBarId = AFX_IDW_CONTROLBAR_FIRST + 40;
const UINT uiLastUserToolBarId = uiFirstUserToolBarId + iMaxUserToolbars - 1;
CString ActFile = "act.dat";
CString DetailFile = "detail.dat";
int ActMode=0;
int PriceMode=0;
BEGIN_MESSAGE_MAP(CMainFrame, CMDIFrameWndEx)
ON_WM_CREATE()
ON_COMMAND(ID_WINDOW_MANAGER, &CMainFrame::OnWindowManager)
ON_COMMAND(ID_VIEW_CUSTOMIZE, &CMainFrame::OnViewCustomize)
ON_REGISTERED_MESSAGE(AFX_WM_
ON_COMMAND_RANGE(ID_VIEW_
ON_UPDATE_COMMAND_UI_RANGE(ID_
ON_COMMAND(ID_FILE_OPEN, &CMainFrame::OnFileOpen)
ON_COMMAND(ID_ACTS_CREATE, &CMainFrame::OnActsCreate)
ON_COMMAND(ID_ACTS_VIEW, &CMainFrame::OnActsView)
ON_COMMAND(ID_ACTS_DELETE, &CMainFrame::OnActsDelete)
ON_COMMAND(ID_ACTS_EDIT, &CMainFrame::OnActsEdit)
ON_COMMAND(ID_ACTS_SEARCH, &CMainFrame::OnActsSearch)
ON_COMMAND(ID_DETAILS_VIEW, &CMainFrame::OnDetailsView)
ON_COMMAND(ID_DETAILS_CREATE, &CMainFrame::OnDetailsCreate)
ON_COMMAND(ID_DETAILS_EDIT, &CMainFrame::OnDetailsEdit)
ON_COMMAND(ID_DETAILS_DELETE, &CMainFrame::OnDetailsDelete)
ON_COMMAND(ID_DETAILS_SEARCH, &CMainFrame::OnDetailsSearch)
END_MESSAGE_MAP()
static UINT indicators[] =
{
ID_SEPARATOR, // status line indicator
ID_INDICATOR_CAPS,
ID_INDICATOR_NUM,
ID_INDICATOR_SCRL,
};
// CMainFrame construction/destruction
CMainFrame::CMainFrame()
{
// TODO: add member initialization code here
theApp.m_nAppLook = theApp.GetInt(_T("
}
CMainFrame::~CMainFrame()
{
}
int CMainFrame::OnCreate(
{
if (CMDIFrameWndEx::OnCreate(
return -1;
BOOL bNameValid;
// set the visual manager and style based on persisted value
OnApplicationLook(theApp.m_
CMDITabInfo mdiTabParams;
mdiTabParams.m_style = CMFCTabCtrl::STYLE_3D_ONENOTE; // other styles available...
mdiTabParams.m_
mdiTabParams.m_bTabIcons = FALSE; // set to TRUE to enable document icons on MDI taba
mdiTabParams.m_bAutoColor = TRUE; // set to FALSE to disable auto-coloring of MDI tabs
mdiTabParams.m_bDocumentMenu = TRUE; // enable the document menu at the right edge of the tab area
EnableMDITabbedGroups(TRUE, mdiTabParams);
if (!m_wndMenuBar.Create(this))
{
TRACE0("Failed to create menubar\n");
return -1; // fail to create
}
m_wndMenuBar.SetPaneStyle(m_
// prevent the menu bar from taking the focus on activation
CMFCPopupMenu::
if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||
!m_wndToolBar.LoadToolBar(
{
TRACE0("Failed to create toolbar\n");
return -1; // fail to create
}
CString strToolBarName;
bNameValid = strToolBarName.LoadString(IDS_
ASSERT(bNameValid);
m_wndToolBar.SetWindowText(
CString strCustomize;
bNameValid = strCustomize.LoadString(IDS_
ASSERT(bNameValid);
m_wndToolBar.
// Allow user-defined toolbars operations:
InitUserToolbars(NULL, uiFirstUserToolBarId, uiLastUserToolBarId);
if (!m_wndStatusBar.Create(this))
{
TRACE0("Failed to create status bar\n");
return -1; // fail to create
}
m_wndStatusBar.SetIndicators(
// TODO: Delete these five lines if you don't want the toolbar and menubar to be dockable
m_wndMenuBar.EnableDocking(
m_wndToolBar.EnableDocking(
EnableDocking(CBRS_ALIGN_ANY);
DockPane(&m_wndMenuBar);
DockPane(&m_wndToolBar);
// enable Visual Studio 2005 style docking window behavior
CDockingManager::
// enable Visual Studio 2005 style docking window auto-hide behavior
EnableAutoHidePanes(CBRS_
// Enable enhanced windows management dialog
EnableWindowsDialog(ID_WINDOW_
// Enable toolbar and docking window menu replacement
EnablePaneMenu(TRUE, ID_VIEW_CUSTOMIZE, strCustomize, ID_VIEW_TOOLBAR);
// enable quick (Alt+drag) toolbar customization
CMFCToolBar::
if (CMFCToolBar::GetUserImages() == NULL)
{
// load user-defined toolbar images
if (m_UserImages.Load(_T(".\\
{
CMFCToolBar::SetUserImages(&m_
}
}
// enable menu personalization (most-recently used commands)
// TODO: define your own basic commands, ensuring that each pulldown menu has at least one basic command.
CList<UINT, UINT> lstBasicCommands;
lstBasicCommands.AddTail(ID_
lstBasicCommands.AddTail(ID_
lstBasicCommands.AddTail(ID_
lstBasicCommands.AddTail(ID_
lstBasicCommands.AddTail(ID_
lstBasicCommands.AddTail(ID_
lstBasicCommands.AddTail(ID_
lstBasicCommands.AddTail(ID_
lstBasicCommands.AddTail(ID_
lstBasicCommands.AddTail(ID_
lstBasicCommands.AddTail(ID_
lstBasicCommands.AddTail(ID_
lstBasicCommands.AddTail(ID_
lstBasicCommands.AddTail(ID_
lstBasicCommands.AddTail(ID_
lstBasicCommands.AddTail(ID_
lstBasicCommands.AddTail(ID_
lstBasicCommands.AddTail(ID_
CMFCToolBar::SetBasicCommands(
// Switch the order of document name and application name on the window title bar. This
// improves the usability of the taskbar because the document name is visible with the thumbnail.
ModifyStyle(0, FWS_PREFIXTITLE);
return 0;
}
BOOL CMainFrame::PreCreateWindow(
{
if( !CMDIFrameWndEx::
return FALSE;
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
return TRUE;
}
// CMainFrame diagnostics
#ifdef _DEBUG
void CMainFrame::AssertValid() const
{
CMDIFrameWndEx::AssertValid();
}
void CMainFrame::Dump(CDumpContext& dc) const
{
CMDIFrameWndEx::Dump(dc);
}
#endif //_DEBUG
// CMainFrame message handlers
void CMainFrame::OnWindowManager()
{
ShowWindowsDialog();
}
void CMainFrame::OnViewCustomize()
{
CMFCToolBarsCustomizeDialog*
pDlgCust = new CMFCToolBarsCustomizeDialog(
pDlgCust->
pDlgCust->Create();
}
LRESULT CMainFrame::
{
LRESULT lres = CMDIFrameWndEx::
if (lres == 0)
{
return 0;
}
CMFCToolBar* pUserToolbar = (CMFCToolBar*)lres;
ASSERT_VALID(pUserToolbar);
BOOL bNameValid;
CString strCustomize;
bNameValid = strCustomize.LoadString(IDS_
ASSERT(bNameValid);
pUserToolbar->
return lres;
}
void CMainFrame::OnApplicationLook(
{
CWaitCursor wait;
theApp.m_nAppLook = id;
switch (theApp.m_nAppLook)
{
case ID_VIEW_APPLOOK_WIN_2000:
CMFCVisualManager::
break;
case ID_VIEW_APPLOOK_OFF_XP:
CMFCVisualManager::
break;
case ID_VIEW_APPLOOK_WIN_XP:
CMFCVisualManagerWindows::m_
CMFCVisualManager::
break;
case ID_VIEW_APPLOOK_OFF_2003:
CMFCVisualManager::
CDockingManager::
break;
case ID_VIEW_APPLOOK_VS_2005:
CMFCVisualManager::
CDockingManager::
break;
case ID_VIEW_APPLOOK_VS_2008:
CMFCVisualManager::
CDockingManager::
break;
case ID_VIEW_APPLOOK_WINDOWS_7:
CMFCVisualManager::
CDockingManager::
break;
default:
switch (theApp.m_nAppLook)
{
case ID_VIEW_APPLOOK_OFF_2007_BLUE:
CMFCVisualManagerOffice2007::
break;
case ID_VIEW_APPLOOK_OFF_2007_
CMFCVisualManagerOffice2007::
break;
case ID_VIEW_APPLOOK_OFF_2007_
CMFCVisualManagerOffice2007::
break;
case ID_VIEW_APPLOOK_OFF_2007_AQUA:
CMFCVisualManagerOffice2007::
break;
}
CMFCVisualManager::
CDockingManager::
}
RedrawWindow(NULL, NULL, RDW_ALLCHILDREN | RDW_INVALIDATE | RDW_UPDATENOW | RDW_FRAME | RDW_ERASE);
theApp.WriteInt(_T("
}
void CMainFrame::
{
pCmdUI->SetRadio(theApp.m_
}
BOOL CMainFrame::LoadFrame(UINT nIDResource, DWORD dwDefaultStyle, CWnd* pParentWnd, CCreateContext* pContext)
{
// base class does the real work
if (!CMDIFrameWndEx::LoadFrame(
{
return FALSE;
}
// enable customization button for all user toolbars
BOOL bNameValid;
CString strCustomize;
bNameValid = strCustomize.LoadString(IDS_
ASSERT(bNameValid);
for (int i = 0; i < iMaxUserToolbars; i ++)
{
CMFCToolBar* pUserToolbar = GetUserToolBarByIndex(i);
if (pUserToolbar != NULL)
{
pUserToolbar->
}
}
return TRUE;
}
void CMainFrame::OnFileOpen()
{
CFilesDlg dlg;
dlg.DoModal();
}
void CMainFrame::OnActsCreate()
{
CActAddDlg dlg;
dlg.DoModal();//вывод диалогового окна
}
void CMainFrame::OnActsView()
{
CActViewDlg dlg;
dlg.DoModal();
}
void CMainFrame::OnActsDelete()
{
ActMode=3;
CActSearchDlg dlg;
dlg.DoModal();
}
void CMainFrame::OnActsEdit()
{
ActMode=2;
CActSearchDlg dlg;
dlg.DoModal();
}
void CMainFrame::OnActsSearch()
{
ActMode=1;
CActSearchDlg dlg;
dlg.DoModal();
}
void CMainFrame::OnDetailsView()
{
CDetailViewDlg dlg;
dlg.DoModal();
}
void CMainFrame::OnDetailsCreate()
{
CDetailAddDlg dlg;
dlg.DoModal();
}
void CMainFrame::OnDetailsEdit()
{
ActMode=2;
CDetailSearchDlg dlg;
dlg.DoModal();
}
void CMainFrame::OnDetailsDelete()
{
ActMode=3;
CDetailSearchDlg dlg;
dlg.DoModal();
}
void CMainFrame::OnDetailsSearch()
{
ActMode=1;
CDetailSearchDlg dlg;
dlg.DoModal();
}
Файл кодов MainFrm.h
// MainFrm.h : interface of the CMainFrame class
//
#pragma once
class CMainFrame : public CMDIFrameWndEx
{
DECLARE_DYNAMIC(CMainFrame)
public:
CMainFrame();
// Attributes
public:
// Operations
public:
// Overrides
public:
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
virtual BOOL LoadFrame(UINT nIDResource, DWORD dwDefaultStyle = WS_OVERLAPPEDWINDOW | FWS_ADDTOTITLE, CWnd* pParentWnd = NULL, CCreateContext* pContext = NULL);
// Implementation
public:
virtual ~CMainFrame();
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif
protected: // control bar embedded members
CMFCMenuBar m_wndMenuBar;
CMFCToolBar m_wndToolBar;
CMFCStatusBar m_wndStatusBar;
CMFCToolBarImages m_UserImages;
// Generated message map functions
protected:
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
afx_msg void OnWindowManager();
afx_msg void OnViewCustomize();
afx_msg LRESULT OnToolbarCreateNew(WPARAM wp, LPARAM lp);
afx_msg void OnApplicationLook(UINT id);
afx_msg void OnUpdateApplicationLook(
DECLARE_MESSAGE_MAP()
public:
afx_msg void OnFileOpen();
afx_msg void OnActsCreate();
afx_msg void OnActsView();
afx_msg void OnActsDelete();
afx_msg void OnActsEdit();
afx_msg void OnActsSearch();
afx_msg void OnDetailsView();
afx_msg void OnDetailsCreate();
afx_msg void OnDetailsEdit();
afx_msg void OnDetailsDelete();
afx_msg void OnDetailsSearch();
};
Информация о работе Разработка списка рабочих, имеющих брак при изготовлении деталей