Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:

Специализированный программно-аппаратный комплекс обучения русскому жестовому языку. Учебное пособие

.pdf
Скачиваний:
0
Добавлен:
15.08.2026
Размер:
1 Мб
Скачать

//{{AFX_DATA_INIT(CreateNewFile)

// NOTE: the ClassWizard will add member initialization here //}}AFX_DATA_INIT

type=0;

}

void CreateNewFile::DoDataExchange(CDataExchange* pDX)

{

CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(CreateNewFile)

// NOTE: the ClassWizard will add DDX and DDV calls here //}}AFX_DATA_MAP

}

BEGIN_MESSAGE_MAP(CreateNewFile, CDialog) //{{AFX_MSG_MAP(CreateNewFile) ON_LBN_SELCHANGE(IDC_LIST1, OnSelchangeList1) ON_NOTIFY(TVN_SELCHANGED, IDC_TREE1, OnSelchangedTree1) ON_EN_CHANGE(IDC_EDIT2, OnChangeEdit2) ON_WM_DESTROY()

//}}AFX_MSG_MAP END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////

// CreateNewFile message handlers BOOL CreateNewFile::OnInitDialog()

{

CDialog::OnInitDialog();

// Get hided tree control for params

CWnd *wtree = GetDlgItem(IDC_TREE1); RECT rc;

wtree->GetWindowRect(&rc); ScreenToClient(&rc);

bcgCM = new CBCGShellManager; bcgShellTree = new CBCGShellTree; bcgShellTree-

>Create(TVS_HASLINES|WS_BORDER|TVS_LINESATROOT|TVS_HASBUTT ONS,rc,this,IDC_TREE1);

long ExStyle = GetWindowLong(wtree->m_hWnd,GWL_STYLE); SetWindowLong(bcgShellTree->m_hWnd,GWL_STYLE,ExStyle); ExStyle = GetWindowLong(wtree->m_hWnd,GWL_EXSTYLE); SetWindowLong(bcgShellTree->m_hWnd,GWL_EXSTYLE,ExStyle); wtree->ShowWindow(SW_HIDE); bcgShellTree->ShowWindow(SW_SHOW); bcgShellTree->UpdateWindow();

bcgShellTree->Refresh();

81

bcgShellTree->EnableShellContextMenu(true); changing = true;

char buff[1024]; ZeroMemory(buff,1024);

if(GetSTRFromReg(PATH_REG_PARAMS,"LastOpenDir", buff))

{

bcgShellTree->SelectPath(buff); FPathName.Format("%s",buff);

}

else bcgShellTree->SelectPath("c:\\");

changing = false; bcgShellTree->GetItemPath(FPathName); SetDlgItemText(IDC_EDIT2,FPathName);

// TODO: Add extra initialization here

CListBox *clb = (CListBox*)GetDlgItem(IDC_LIST1); //DirectX3D Sprite game library

for(int i=0;i<MAX_ENGINE_SUPPORTED_TYPES;i++)

{

clb->InsertString(i,sz_FileTypesNames[i]);

}

clb->SetCurSel(0); if(clb->GetCurSel()!=LB_ERR)

GetDlgItem(IDOK)->EnableWindow(true); CEdit *ceb = (CEdit *)GetDlgItem(IDC_EDIT1); ceb->SetLimitText(1020);

//Uncomment this lines to set line length limit to 1020

//ceb = (CEdit *)GetDlgItem(IDC_EDIT2);

//ceb->SetLimitText(1020);

return TRUE; // return TRUE unless you set the focus to a control

// EXCEPTION: OCX Property Pages should return FALSE

}

void CreateNewFile::OnSelchangeList1()

{

// TODO: Add your control notification handler code here CListBox *clb = (CListBox*)GetDlgItem(IDC_LIST1); type = clb->GetCurSel();

if(type>=0 && type!=LB_ERR) GetDlgItem(IDOK)->EnableWindow(true);

else GetDlgItem(IDOK)->EnableWindow(false);

}

82

void CreateNewFile::OnOK()

{

// TODO: Add extra validation here bool create=false; GetDlgItemText(IDC_EDIT1,FName);

GetDlgItemText(IDC_EDIT2,FPathName); if(!SetCurrentDirectory(FPathName.LockBuffer()))

AfxMessageBox("Please select right birectory!"); else

{

if(FName.GetLength()>0)

{

FILE *fp=fopen(FName.LockBuffer(),"r"); if(fp!=NULL)

{

fclose(fp);

if(AfxMessageBox("File already exist replase?",MB_YESNO)==IDYES)

{

fp=fopen(FName.LockBuffer(),"r+");

if(fp!=NULL)

{

fclose(fp); create = true;

}

else

AfxMessageBox("Can't reesive access to enteren file!");

}

}

else create = true; FName.UnlockBuffer();

}

else

AfxMessageBox("Please enter file name!");

}

FPathName.UnlockBuffer();

if(create)

{

type++;

SetSTRToReg(PATH_REG_PARAMS,"LastOpenDir", FPathName); CDialog::OnOK();

}

}

83

void CreateNewFile::OnSelchangedTree1(NMHDR* pNMHDR, LRESULT* pResult)

{

NM_TREEVIEW* pNMTreeView = (NM_TREEVIEW*)pNMHDR; // TODO: Add your control notification handler code here if(!changing)

{

bcgShellTree->GetItemPath(FPathName); SetDlgItemText(IDC_EDIT2,FPathName);

}

*pResult = 0;

}

void CreateNewFile::OnChangeEdit2()

{

//TODO: If this is a RICHEDIT control, the control will not

//send this notification unless you override the CDialog::OnInitDialog()

//function and call CRichEditCtrl().SetEventMask()

//with the ENM_CHANGE flag ORed into the mask.

// TODO: Add your control notification handler code here CString cs;

GetDlgItemText(IDC_EDIT2,cs); if(cs.GetLength()>1)

{

changing = true; bcgShellTree->SelectPath(cs.LockBuffer()); cs.UnlockBuffer();

changing = false;

}

}

void CreateNewFile::OnDestroy()

{

CDialog::OnDestroy();

// TODO: Add your message handler code here delete bcgCM;

delete bcgShellTree;

84

Соседние файлы в предмете [НЕСОРТИРОВАННОЕ]