0% found this document useful (0 votes)
72 views3 pages

User Access Management in MFC Dialogs

This document contains code for a C++ program that implements password protection and child windows. It includes code for a Cosoriowork dialog class that handles password validation and opening additional dialogs. It also includes code for a CosorioworkDlg class that is the main dialog window and contains a button click handler to open the Cosoriowork dialog.

Uploaded by

david carranza
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
72 views3 pages

User Access Management in MFC Dialogs

This document contains code for a C++ program that implements password protection and child windows. It includes code for a Cosoriowork dialog class that handles password validation and opening additional dialogs. It also includes code for a CosorioworkDlg class that is the main dialog window and contains a button click handler to open the Cosoriowork dialog.

Uploaded by

david carranza
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

3RA PRACTICA CALIFICADA(MB545)

Alumno: David Carranza Zavala Código: 20174065E

Password y Usuarios
#include "stdafx.h"
#include "osorio work.h"
#include "Cosoriowork.h"
#include "afxdialogex.h"

// Cosoriowork dialog

IMPLEMENT_DYNAMIC(Cosoriowork, CDialogEx)

Cosoriowork::Cosoriowork(CWnd* pParent /*=NULL*/)


: CDialogEx(Cosoriowork::IDD, pParent)
{

Cosoriowork::~Cosoriowork()
{
}

void Cosoriowork::DoDataExchange(CDataExchange* pDX)


{
CDialogEx::DoDataExchange(pDX);
}

BEGIN_MESSAGE_MAP(Cosoriowork, CDialogEx)
ON_EN_CHANGE(IDC_EDIT1, &Cosoriowork::OnEnChangeEdit1)
ON_BN_CLICKED(IDC_BUTTON1, &Cosoriowork::OnBnClickedButton1)
ON_BN_CLICKED(IDC_BUTTON2, &Cosoriowork::OnBnClickedButton2)
ON_EN_CHANGE(IDC_EDIT2, &Cosoriowork::OnEnChangeEdit2)
END_MESSAGE_MAP()

// Cosoriowork message handlers

void Cosoriowork::OnEnChangeEdit1()
{UpdateData(true);
CString clave = "carranza"
if(strcmp(){
CAccesoDlg acceso;
acceso.DoModal();
}
else
MessageBox(_T("No tiene acceso")):
UpdateData(false);

{MessageBox(_T("Ingresó al sistema"),_T("Usuario confirmado"),MB_ICONQUESTION);


Cav ss;
ss.DoModal();}
else
// TODO: If this is a RICHEDIT control, the control will not
// send this notification unless you override the
CDialogEx::OnInitDialog()
// function and call CRichEditCtrl().SetEventMask()
// with the ENM_CHANGE flag ORed into the mask.

// TODO: Add your control notification handler code here


}

void Cosoriowork::OnEnChangeEdit2()
{
// TODO: If this is a RICHEDIT control, the control will not
// send this notification unless you override the
CDialogEx::OnInitDialog()
// function and call CRichEditCtrl().SetEventMask()
// with the ENM_CHANGE flag ORed into the mask.

// TODO: Add your control notification handler code here


}

Ventanas Hijas
#include "stdafx.h"
#include "osorio work.h"
#include "osorio workDlg.h"
#include "afxdialogex.h"
#include "Cosoriowork.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#endif

// CosorioworkDlg dialog

CosorioworkDlg::CosorioworkDlg(CWnd* pParent /*=NULL*/)


: CDialogEx(CosorioworkDlg::IDD, pParent)
{
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}

void CosorioworkDlg::DoDataExchange(CDataExchange* pDX)


{
CDialogEx::DoDataExchange(pDX);
}

BEGIN_MESSAGE_MAP(CosorioworkDlg, CDialogEx)
ON_WM_PAINT()
ON_WM_QUERYDRAGICON()
ON_BN_CLICKED(IDC_BUTTON1, &CosorioworkDlg::OnBnClickedButton1)
END_MESSAGE_MAP()

// CosorioworkDlg message handlers

BOOL CosorioworkDlg::OnInitDialog()
{
CDialogEx::OnInitDialog();

// Set the icon for this dialog. The framework does this automatically
// when the application's main window is not a dialog
SetIcon(m_hIcon, TRUE); // Set big icon
SetIcon(m_hIcon, FALSE); // Set small icon

// TODO: Add extra initialization here

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

// If you add a minimize button to your dialog, you will need the code below
// to draw the icon. For MFC applications using the document/view model,
// this is automatically done for you by the framework.

void CosorioworkDlg::OnPaint()
{
if (IsIconic())
{
CPaintDC dc(this); // device context for painting

SendMessage(WM_ICONERASEBKGND,
reinterpret_cast<WPARAM>(dc.GetSafeHdc()), 0);

// Center icon in client rectangle


int cxIcon = GetSystemMetrics(SM_CXICON);
int cyIcon = GetSystemMetrics(SM_CYICON);
CRect rect;
GetClientRect(&rect);
int x = (rect.Width() - cxIcon + 1) / 2;
int y = (rect.Height() - cyIcon + 1) / 2;

// Draw the icon


dc.DrawIcon(x, y, m_hIcon);
}
else
{
CDialogEx::OnPaint();
}
}

// The system calls this function to obtain the cursor to display while the user
drags
// the minimized window.
HCURSOR CosorioworkDlg::OnQueryDragIcon()
{
return static_cast<HCURSOR>(m_hIcon);
}

void CosorioworkDlg::OnBnClickedButton1()
{
Cosoriowork prom;
prom.DoModal();
// TODO: Add your control notification handler code here
}

You might also like