Sei sulla pagina 1di 95

UNIVERSIDAD TCNICA DE AMBATO

FACULTAD DE INGENIERA CIVL Y MECNICA CARRERA DE INGENIERA MECNICA LENGUAJE DE PROGRAMACIN

INTEGRANTES: FECHA: CURSO: TEMA:

JONATHAN TORRES ANGEL CHANGO

09/01/2013 TERCERO B GUIA DE OPERACINES

UNIVERSIDAD TCNICA DE AMBATO

3RO B

2. INDICE 1. 2. 3. 4. Caratula ndice Tema Objetivos 4.1 Objetivo general 4.2 Objetivo especficos

5. Resumen 6. Marco terico Operaciones bsicas Personalizado de nmeros Conteo de caracteres Eliminacin de caracteres Gua para transformar texto en Maysculas y Minsculas con MENS.

7. Conclusiones 8. Recomendaciones 9. Bibliografa 10. Anexo

JONATHAN TORRES ANGEL CHANGO

UNIVERSIDAD TCNICA DE AMBATO

3RO B

3. Tema Gua de Ejercicios bsicos en el programa Microsoft Visual C++ 6.0. 4. Objetivos 4.1 Objetivo general Optimizar el aprendizaje mediante la realizacin de esta gua de operaciones bsicas en el programa Microsoft Visual C++ 6.0. 4.2 Objetivo especficos - Ejecutar con eficacia el Programa Visual C++, en el cual se realizara las operaciones bsicas que realice (suma, resta, multiplicacin, divisin). Aprender la ejecucin y funcionamiento los diferentes cdigos, para los comandos de ejecucin en el programa Visual C++. Aplicar el funcionamiento del programa Visual C++, y su ejecucin.

- Aplicar los cdigos aprendidos para la ejecucin de conteo de caracteres. - Implementar Un personalizado acorde de las necesidades del usuario. - Ejecutar y verificar que el programa realizado se desarrolle de modo eficaz y preciso. - Realizar la gua con todos los pasos necesarios para cada ejercicio correspondiente. - Insertar grficos segn como se va desarrollando la gua de ejercicios.

JONATHAN TORRES ANGEL CHANGO

UNIVERSIDAD TCNICA DE AMBATO

3RO B

5. Resumen En el presente trabajo, la resolucin de las guas de trabajo en el programa Microsoft Visual C++ 6.0, cada una de las guas describe paso a paso los cdigos y comandos a ingresar correctamente para un buen desarrollo y ejecucin de sus respectivos programas.
En la ejecucin de la gua de las operaciones bsicas se realizo con eficacia tomando en consideracin los errores que se presentaban, los cuales dificultaron el proceso de ejecucin con respecto a los resultados que se presentaban obtener. El programa de computador Visual Basic C++, ofrece diferentes funciones para realizar un programa ejecutable en base a nuestras disposiciones, las cuales fueron las operaciones bsicas como son: suma, resta, multiplicacin y divisin permitindonos as una ejecucin favorable del programa con el correcto ingreso de datos y comandos.

JONATHAN TORRES ANGEL CHANGO

UNIVERSIDAD TCNICA DE AMBATO

3RO B

6.

Desarrollo Operaciones matemticas bsicas

Dar doble clic en el icono para comenzar un nuevo proyecto.

Luego de dar doble clic en el icono enseguida dar clic en la opcin FILE y elegir nuevo.

JONATHAN TORRES ANGEL CHANGO

UNIVERSIDAD TCNICA DE AMBATO

3RO B

Para comenzar el proyecto es escoger el lugar donde se va a guardar el archivo y dar nombre al mismo que en este caso el archivo se llamara (operaciones bsicas).

Despus escoger la opcin MFC AppWizard (exe) que se necesita para la realizacin del proyecto.

JONATHAN TORRES ANGEL CHANGO

UNIVERSIDAD TCNICA DE AMBATO

3RO B

A continuacin para activar la aplicacin escoger la opcin de Dialog Basic y dar clic en FINISH

Automticamente la ventana de proyecto est lista para usarse.

JONATHAN TORRES ANGEL CHANGO

UNIVERSIDAD TCNICA DE AMBATO

3RO B

Proceder a ingresar los datos informativos en la ventana donde se va a realizar los ejercicios.

Para comenzar a realizar la operaciones EDITBOX y arrastramos a

siguientes insertar la opcin la ventana principal.

JONATHAN TORRES ANGEL CHANGO

UNIVERSIDAD TCNICA DE AMBATO

3RO B

Despus de ingresar dos EDITBOX ms procedemos a arrastrar la opcin que dice BUTTON la cual la llamaremos suma.

Seguir con el mismo procedimiento insertando botones con el nombre de las cuatro operaciones bsicas.

JONATHAN TORRES ANGEL CHANGO

UNIVERSIDAD TCNICA DE AMBATO

3RO B

Para la realizacin del proyecto primero dar nombres a las variables que es ente caso serian las opciones de los Edit. 1, 2, 3 respectivamente, oprimiendo (Ctrl+W), clic en la opcin MEMBER VARIABLES.

Luego dar clic donde se va a dar nombre a la variable en realidad donde se va introducir los datos numricos en este caso del proyecto, despus de seleccionar dar clic en la opcin ADD VARIABLE

JONATHAN TORRES ANGEL CHANGO

10

UNIVERSIDAD TCNICA DE AMBATO

3RO B

A continuacin de aparecer la ventana correspondiente procedimos a dar nombre a las variables que en este caso seria m_1, y seguidamente escoger el tipo de variable se va introducirse para ello dar clic en VARIABLE TYPE y escoger la opcin INT que este caso significa nmeros enteros para los cual se va a trabajar en este proyecto.

As proseguir el mismo procedimiento con las dems opciones la variables se llamaran es si m_1, m_2, m_3 respectivamente.

JONATHAN TORRES ANGEL CHANGO

11

UNIVERSIDAD TCNICA DE AMBATO

3RO B

Despus de aadir los nombres de las variables para proseguir con la operacin dar doble clic en el primer botn puesto anteriormente, seguidamente se aparece una ventana donde se insertara el cdigo necesario para realizar la operacin correspondiente.

JONATHAN TORRES ANGEL CHANGO

12

UNIVERSIDAD TCNICA DE AMBATO

3RO B

Borrar la frase que est pintado con color negro e introducir el cdigo que para el caso de la suma seria: UpdateData(true); m_3=m_1+m_2; UpdateData(false); Porqu se introduce m_3 primero, porque ah se va el resultado o la respuesta del dicho comando SUMA o BUTTON1

Despus de introducir el cdigo procedemos a correr el programa creado para ello dar clic en el botn siguiente:

JONATHAN TORRES ANGEL CHANGO

13

UNIVERSIDAD TCNICA DE AMBATO

3RO B

A continuacin se correr el programa automticamente indicando en la parte inferior izquierda los errores que posee el procedimiento, aparecer un cuadro indicando el programa ya resuelto en la ventana principal.

JONATHAN TORRES ANGEL CHANGO

14

UNIVERSIDAD TCNICA DE AMBATO

3RO B

En este caso es un ejemplo si existe un error o varios si esto llega a pasar, el programa no se correr, el error se producir cuando se han ingresado mal los datos en el cdigo correspondiente.

JONATHAN TORRES ANGEL CHANGO

15

UNIVERSIDAD TCNICA DE AMBATO

3RO B

Despus de hacer correr el programa verificamos si esta funcionado el comando con la instruccin dada al respectivo SUMA O BUTTON1 indicado anteriormente.

Para la realizacin de la dems operaciones y para salir de la ventana en la que se encuentra en este momento, dar clic en la opcin que esta continuacin:

JONATHAN TORRES ANGEL CHANGO

16

UNIVERSIDAD TCNICA DE AMBATO

3RO B

JONATHAN TORRES ANGEL CHANGO

17

UNIVERSIDAD TCNICA DE AMBATO

3RO B

Seguidamente realizamos el mismo procedimiento que en el caso anterior con las dems operaciones siguientes, eso s con el mismo cdigo puesto anteriormente sino que en este caso con los signos de operacin (+, -, *, /,) correspondientes a cada BUTTON O BOTON as por ej. RESTA UpdateData(true); m_3=m_1-m_2; UpdateData(false); MULTIPLICACIN UpdateData(true); m_3=m_1*m_2; UpdateData(false); DIVISIN UpdateData(true); m_3=m_1/m_2; UpdateData(false);

SUMA UpdateData(true); m_3=m_1+m_2; UpdateData(false);

JONATHAN TORRES ANGEL CHANGO

18

UNIVERSIDAD TCNICA DE AMBATO

3RO B

As mismo para ver si se corre el programa correctamente dar clic en la opcin:

Despus de hacer correr el programa verificamos si esta funcionado el comando con la instruccin dada al respectivo RESTA O BUTTON2 y los dems operaciones ingresadas anteriormente. OPERACIN RESTA

JONATHAN TORRES ANGEL CHANGO

19

UNIVERSIDAD TCNICA DE AMBATO

3RO B

OPERACIN MULTIPLICACIN

OPERACIN DIVISIN

JONATHAN TORRES ANGEL CHANGO

20

UNIVERSIDAD TCNICA DE AMBATO

3RO B

As queda lista resuelto las 4 operaciones bsicas en el programa Microsoft Visual C++ 6.0, a continuacin presentaremos el cdigo completo que se origino a la realizacin de este archivo.

Cdigo completo // OPERACIONES BASICASDlg.cpp : implementation file // #include "stdafx.h" #include "OPERACIONES BASICAS.h" #include "OPERACIONES BASICASDlg.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // CAboutDlg dialog used for App About class CAboutDlg : public CDialog { public: CAboutDlg(); // Dialog Data //{{AFX_DATA(CAboutDlg) enum { IDD = IDD_ABOUTBOX }; //}}AFX_DATA // ClassWizard generated virtual function overrides //{{AFX_VIRTUAL(CAboutDlg) protected: virtual void DoDataExchange(CDataExchange* pDX); support //}}AFX_VIRTUAL // Implementation protected: //{{AFX_MSG(CAboutDlg) //}}AFX_MSG DECLARE_MESSAGE_MAP() }; CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
JONATHAN TORRES ANGEL CHANGO

// DDX/DDV

21

UNIVERSIDAD TCNICA DE AMBATO

3RO B

{ //{{AFX_DATA_INIT(CAboutDlg) //}}AFX_DATA_INIT } void CAboutDlg::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(CAboutDlg) //}}AFX_DATA_MAP } BEGIN_MESSAGE_MAP(CAboutDlg, CDialog) //{{AFX_MSG_MAP(CAboutDlg) // No message handlers //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // COPERACIONESBASICASDlg dialog COPERACIONESBASICASDlg::COPERACIONESBASICASDlg(CWnd* pParent /*=NULL*/) : CDialog(COPERACIONESBASICASDlg::IDD, pParent) { //{{AFX_DATA_INIT(COPERACIONESBASICASDlg) m_1 = 0; m_2 = 0; m_3 = 0; //}}AFX_DATA_INIT // Note that LoadIcon does not require a subsequent DestroyIcon in Win32 m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME); } void COPERACIONESBASICASDlg::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(COPERACIONESBASICASDlg) DDX_Text(pDX, IDC_EDIT1, m_1); DDX_Text(pDX, IDC_EDIT2, m_2); DDX_Text(pDX, IDC_EDIT3, m_3); //}}AFX_DATA_MAP } BEGIN_MESSAGE_MAP(COPERACIONESBASICASDlg, CDialog) //{{AFX_MSG_MAP(COPERACIONESBASICASDlg) ON_WM_SYSCOMMAND()
JONATHAN TORRES ANGEL CHANGO

22

UNIVERSIDAD TCNICA DE AMBATO

3RO B

ON_WM_PAINT() ON_WM_QUERYDRAGICON() ON_BN_CLICKED(IDC_BUTTON1, OnButton1) ON_BN_CLICKED(IDC_BUTTON2, OnButton2) ON_BN_CLICKED(IDC_BUTTON3, OnButton3) ON_BN_CLICKED(IDC_BUTTON4, OnButton4) //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // COPERACIONESBASICASDlg message handlers BOOL COPERACIONESBASICASDlg::OnInitDialog() { CDialog::OnInitDialog(); // Add "About..." menu item to system menu. // IDM_ABOUTBOX must be in the system command range. ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX); ASSERT(IDM_ABOUTBOX < 0xF000); CMenu* pSysMenu = GetSystemMenu(FALSE); if (pSysMenu != NULL) { CString strAboutMenu; strAboutMenu.LoadString(IDS_ABOUTBOX); if (!strAboutMenu.IsEmpty()) { pSysMenu->AppendMenu(MF_SEPARATOR); pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu); } } // 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 } void COPERACIONESBASICASDlg::OnSysCommand(UINT lParam)
JONATHAN TORRES ANGEL CHANGO

nID,

LPARAM

23

UNIVERSIDAD TCNICA DE AMBATO

3RO B

{ if ((nID & 0xFFF0) == IDM_ABOUTBOX) { CAboutDlg dlgAbout; dlgAbout.DoModal(); } else { CDialog::OnSysCommand(nID, lParam); } } // 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 COPERACIONESBASICASDlg::OnPaint() { if (IsIconic()) { CPaintDC dc(this); // device context for painting SendMessage(WM_ICONERASEBKGND, 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 { CDialog::OnPaint(); } } // The system calls this to obtain the cursor to display while the user drags // the minimized window. HCURSOR COPERACIONESBASICASDlg::OnQueryDragIcon() { return (HCURSOR) m_hIcon;
JONATHAN TORRES ANGEL CHANGO

(WPARAM)

24

UNIVERSIDAD TCNICA DE AMBATO

3RO B

} void COPERACIONESBASICASDlg::OnButton1() { UpdateData(true); m_3=m_1+m_2; UpdateData(false); } void COPERACIONESBASICASDlg::OnButton2() { UpdateData(true); m_3=m_1-m_2; UpdateData(false); } void COPERACIONESBASICASDlg::OnButton3() { UpdateData(true); m_3=m_1*m_2; UpdateData(false); } void COPERACIONESBASICASDlg::OnButton4() { UpdateData(true); m_3=m_1/m_2; UpdateData(false); }

JONATHAN TORRES ANGEL CHANGO

25

UNIVERSIDAD TCNICA DE AMBATO

3RO B

Gua para Personalizar caracteres

Dar doble clic en el icono para comenzar un nuevo proyecto.

Luego de dar doble clic en el icono enseguida dar clic en la opcin FILE y elegir nuevo.

JONATHAN TORRES ANGEL CHANGO

26

UNIVERSIDAD TCNICA DE AMBATO

3RO B

Para comenzar el proyecto es escoger el lugar donde se va a guardar el archivo y dar nombre al mismo que en este caso el archivo se llamara (PERSONALIZADO).

A continuacin para activar la aplicacin escoger la opcin de Dialog Basic y dar clic en FINISH

JONATHAN TORRES ANGEL CHANGO

27

UNIVERSIDAD TCNICA DE AMBATO

3RO B

Proceder a ingresar los datos informativos en la ventana donde se va a realizar los ejercicios.

Inmediatamente ingresamos los EDIT BOX Y BOTONES correspondientes donde van las variables y operaciones con sus respectivos nombres.

JONATHAN TORRES ANGEL CHANGO

28

UNIVERSIDAD TCNICA DE AMBATO

3RO B

Para la realizacin del proyecto primero dar nombres a las variables que en este caso serian las opciones de los Edit. 1, 2, respectivamente, oprimiendo (Ctrl+W), clic en la opcin MEMBER VARIABLES.

Luego dar clic donde se va a dar nombre a la variable en realidad donde se va introducir los datos numricos en este caso del proyecto, despus de seleccionar dar clic en la opcin ADD VARIABLE

JONATHAN TORRES ANGEL CHANGO

29

UNIVERSIDAD TCNICA DE AMBATO

3RO B

A continuacin de aparecer la ventana correspondiente procedimos a dar nombre a las variables que en este caso seria m_1, y seguidamente escoger el tipo de variable se va introducirse para ello dar clic en VARIABLE TYPE y escoger la opcin INT que este caso significa que se va ingresar nmeros para los cual se va a trabajar en este proyecto.

As proseguir el mismo procedimiento con las dems opciones la variable.

JONATHAN TORRES ANGEL CHANGO

30

UNIVERSIDAD TCNICA DE AMBATO

3RO B

Luego regresar a la pantalla principal y dar doble clic en el primer botn para la realizacin del proyecto e ingresar el cdigo necesario para que opere dicho programa en primer caso ser SUBIR.

El cdigo es:

Seguir el mismo procedimiento con los botones BAJAR, SUBIR 3, BAJAR 3. pero en este caso cambiara : BAJAR UpdateData(true); m_1--; UpdateData(false); SUBIR 3 UpdateData(true); m_1+=3; UpdateData(false); BAJAR 3 UpdateData(true); m_1-=3; UpdateData(false);

SUBIR UpdateData(true); m_1++; UpdateData(false);

JONATHAN TORRES ANGEL CHANGO

31

UNIVERSIDAD TCNICA DE AMBATO

3RO B

Luego regresar a la pantalla principal y dar doble clic en el botn SUBIR PERSONLIZADO este botn servir para escoger nuestro propio nmero y realizar cualquier operacin.

JONATHAN TORRES ANGEL CHANGO

32

UNIVERSIDAD TCNICA DE AMBATO

3RO B

El cdigo es:

Seguir el mismo procedimiento con el otro botn BAJAR PERSONLIZADO pero en este caso cambiara : BAJAR PERSONALIZADO UpdateData(true); m_1-=m_2; UpdateData(false);

SUBIR PERSONALIZADO UpdateData(true); m_1+=m_2; UpdateData(false);

JONATHAN TORRES ANGEL CHANGO

33

UNIVERSIDAD TCNICA DE AMBATO

3RO B

El programa le hacer correr y probar si todo funciona correctamente probando cada uno de los comandos que funcionen en cada Editbox,

1). SUBIR

2). BAJAR

JONATHAN TORRES ANGEL CHANGO

34

UNIVERSIDAD TCNICA DE AMBATO

3RO B

3). SUBIR 3, Y BAJAR 3

JONATHAN TORRES ANGEL CHANGO

35

UNIVERSIDAD TCNICA DE AMBATO

3RO B

2).SUBIR Y BAJAR PERSONLIZADO esta opcin es diferente a la primera, aqu ingresar el nmero desde donde se va ser las operaciones. 1). SUBIR PERSONLIZADO

2). BAJAR PERSONLIZADO

JONATHAN TORRES ANGEL CHANGO

36

UNIVERSIDAD TCNICA DE AMBATO

3RO B

As queda lista resuelto la operacin PERSONALIZADO en el programa Microsoft Visual C++ 6.0, a continuacin presentaremos el cdigo completo que se origino a la realizacin de este archivo.

Cdigo Complero // PERSONALIZADODlg.cpp : implementation file // #include "stdafx.h" #include "PERSONALIZADO.h" #include "PERSONALIZADODlg.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // CAboutDlg dialog used for App About class CAboutDlg : public CDialog { public: CAboutDlg(); // Dialog Data //{{AFX_DATA(CAboutDlg) enum { IDD = IDD_ABOUTBOX }; //}}AFX_DATA // ClassWizard generated virtual function overrides //{{AFX_VIRTUAL(CAboutDlg) protected: virtual void DoDataExchange(CDataExchange* pDX); support //}}AFX_VIRTUAL // Implementation protected: //{{AFX_MSG(CAboutDlg) //}}AFX_MSG DECLARE_MESSAGE_MAP() }; CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
JONATHAN TORRES ANGEL CHANGO

// DDX/DDV

37

UNIVERSIDAD TCNICA DE AMBATO

3RO B

{ //{{AFX_DATA_INIT(CAboutDlg) //}}AFX_DATA_INIT } void CAboutDlg::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(CAboutDlg) //}}AFX_DATA_MAP } BEGIN_MESSAGE_MAP(CAboutDlg, CDialog) //{{AFX_MSG_MAP(CAboutDlg) // No message handlers //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CPERSONALIZADODlg dialog CPERSONALIZADODlg::CPERSONALIZADODlg(CWnd* pParent /*=NULL*/) : CDialog(CPERSONALIZADODlg::IDD, pParent) { //{{AFX_DATA_INIT(CPERSONALIZADODlg) m_1 = 0; m_2 = 0; //}}AFX_DATA_INIT // Note that LoadIcon does not require a subsequent DestroyIcon in Win32 m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME); } void CPERSONALIZADODlg::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(CPERSONALIZADODlg) DDX_Text(pDX, IDC_EDIT1, m_1); DDX_Text(pDX, IDC_EDIT2, m_2); //}}AFX_DATA_MAP } BEGIN_MESSAGE_MAP(CPERSONALIZADODlg, CDialog) //{{AFX_MSG_MAP(CPERSONALIZADODlg) ON_WM_SYSCOMMAND() ON_WM_PAINT() ON_WM_QUERYDRAGICON() ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
JONATHAN TORRES ANGEL CHANGO

38

UNIVERSIDAD TCNICA DE AMBATO

3RO B

ON_BN_CLICKED(IDC_BUTTON2, OnButton2) ON_BN_CLICKED(IDC_BUTTON3, OnButton3) ON_BN_CLICKED(IDC_BUTTON4, OnButton4) ON_BN_CLICKED(IDC_BUTTON5, OnButton5) ON_BN_CLICKED(IDC_BUTTON6, OnButton6) //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CPERSONALIZADODlg message handlers BOOL CPERSONALIZADODlg::OnInitDialog() { CDialog::OnInitDialog(); // Add "About..." menu item to system menu. // IDM_ABOUTBOX must be in the system command range. ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX); ASSERT(IDM_ABOUTBOX < 0xF000); CMenu* pSysMenu = GetSystemMenu(FALSE); if (pSysMenu != NULL) { CString strAboutMenu; strAboutMenu.LoadString(IDS_ABOUTBOX); if (!strAboutMenu.IsEmpty()) { pSysMenu->AppendMenu(MF_SEPARATOR); pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu); } } // 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 } void CPERSONALIZADODlg::OnSysCommand(UINT nID, LPARAM lParam) { if ((nID & 0xFFF0) == IDM_ABOUTBOX)
JONATHAN TORRES ANGEL CHANGO

39

UNIVERSIDAD TCNICA DE AMBATO

3RO B

{ CAboutDlg dlgAbout; dlgAbout.DoModal(); } else { CDialog::OnSysCommand(nID, lParam); } } // 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 CPERSONALIZADODlg::OnPaint() { if (IsIconic()) { CPaintDC dc(this); // device context for painting SendMessage(WM_ICONERASEBKGND, 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 { CDialog::OnPaint(); } } // The system calls this to obtain the cursor to display while the user drags // the minimized window. HCURSOR CPERSONALIZADODlg::OnQueryDragIcon() { return (HCURSOR) m_hIcon; }
JONATHAN TORRES ANGEL CHANGO

(WPARAM)

40

UNIVERSIDAD TCNICA DE AMBATO

3RO B

void CPERSONALIZADODlg::OnButton1() { UpdateData(true); m_1++; UpdateData(false); } void CPERSONALIZADODlg::OnButton2() { UpdateData(true); m_1--; UpdateData(false); } void CPERSONALIZADODlg::OnButton3() { UpdateData(true); m_1+=3; UpdateData(false); } void CPERSONALIZADODlg::OnButton4() { UpdateData(true); m_1-=3; UpdateData(false); } void CPERSONALIZADODlg::OnButton5() { UpdateData(true); m_1+=m_2; UpdateData(false); } void CPERSONALIZADODlg::OnButton6() { UpdateData(true); m_1-=m_2; UpdateData(false); }

JONATHAN TORRES ANGEL CHANGO

41

UNIVERSIDAD TCNICA DE AMBATO

3RO B

Gua para la Conteo de caracteres con men

Dar doble clic en el icono para comenzar un nuevo proyecto.

Luego de dar doble clic en el icono enseguida dar clic en la opcin FILE y elegir nuevo.

JONATHAN TORRES ANGEL CHANGO

42

UNIVERSIDAD TCNICA DE AMBATO

3RO B

Para comenzar el proyecto es escoger el lugar donde se va a guardar el archivo y dar nombre al mismo que en este caso el archivo se llamara (CONTEO DE CARACTERES).

A continuacin para activar la aplicacin escoger la opcin de Dialog Basic y dar clic en FINISH

JONATHAN TORRES ANGEL CHANGO

43

UNIVERSIDAD TCNICA DE AMBATO

3RO B

Automticamente la ventana de proyecto est lista para usarse.

Proceder a ingresar los datos informativos en la ventana donde se va a realizar los ejercicios.

JONATHAN TORRES ANGEL CHANGO

44

UNIVERSIDAD TCNICA DE AMBATO

3RO B

Inmediatamente ingresamos los EDIT BOX, adems un Static text correspondientes donde van las variables y operaciones.

En el caso de Static para que se aparezca su nombre donde se ingresa las variables dar clic derecho en ella, luego en propiedades y cambiar su nombre.

JONATHAN TORRES ANGEL CHANGO

45

UNIVERSIDAD TCNICA DE AMBATO

3RO B

Para la realizacin del proyecto primero dar nombres a las variables que en este caso serian las opciones de los Edit. 1, 2, 3 respectivamente, oprimiendo (Ctrl+W), clic en la opcin MEMBER VARIABLES.

Luego dar clic donde se va a dar nombre a la variable en realidad donde se va introducir los datos numricos en este caso del proyecto, despus de seleccionar dar clic en la opcin ADD VARIABLE , e ingresar el nombre de las variables.

JONATHAN TORRES ANGEL CHANGO

46

UNIVERSIDAD TCNICA DE AMBATO

3RO B

Ahora se va ingresar un MEN que se llamara CONTEO ESCOJIDO AUTOMATICO, pero ello clic derecho en la parte superior izquierda de la ventana, opcin INSERT, luego clic en men y despus en NEW

JONATHAN TORRES ANGEL CHANGO

47

UNIVERSIDAD TCNICA DE AMBATO

3RO B

Automticamente se abre una ventana donde se insertara el men, el primer nombre ser funcin, y el otro se llamara CONTEO ESCOJIDO AUTOMATICO.

Luego regresar a la pantalla principal y dar doble clic en el primer EDITBOX para la realizacin del proyecto e ingresar el cdigo necesario para que opere dicho programa, en este cdigo funcionan los otros EDITBOX.

JONATHAN TORRES ANGEL CHANGO

48

UNIVERSIDAD TCNICA DE AMBATO

3RO B

Ahora se habilitara el men ingresado anteriormente as mismo regresar a la ventana principal pero en este caso dar clic derecho en la ventana, opcin propiedades.

Dar clic en men, clic en la pestaa y clic en la opcin en la nica que esta.

JONATHAN TORRES ANGEL CHANGO

49

UNIVERSIDAD TCNICA DE AMBATO

3RO B

Despus de lo realizado anteriormente nuevamente oprimir (Crtl+w) esta vez para activar su comando o su funcin que va a realizar, clic en la opcin Message Maps, luego clic en el men creado anteriormente y doble clic en la opcin COMMAND y despues Edit code.

Dado clic en Edit code, para que realice la funcin ingresar el comando correspondiente.

JONATHAN TORRES ANGEL CHANGO

50

UNIVERSIDAD TCNICA DE AMBATO

3RO B

El programa le hacer correr y probar si todo funciona correctamente probando cada uno de los comandos que funcionen en cada Editbox, y tambin con su respectivo men ingresado anteriormente.

1). Ingresando una palabra

Comando que funciona con Men

JONATHAN TORRES ANGEL CHANGO

51

UNIVERSIDAD TCNICA DE AMBATO

3RO B

As queda lista resuelto la operacin ELIMINACIN en el programa Microsoft Visual C++ 6.0, a continuacin presentaremos el cdigo completo que se origino a la realizacin de este archivo.

Cdigo Completo // CONTEO DE CARACTERESDlg.cpp : implementation file // #include "stdafx.h" #include "new.h" #include "newDlg.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // CAboutDlg dialog used for App About class CAboutDlg : public CDialog { public: CAboutDlg(); // Dialog Data //{{AFX_DATA(CAboutDlg) enum { IDD = IDD_ABOUTBOX }; //}}AFX_DATA // ClassWizard generated virtual function overrides //{{AFX_VIRTUAL(CAboutDlg) protected: virtual void DoDataExchange(CDataExchange* pDX); support //}}AFX_VIRTUAL // Implementation protected: //{{AFX_MSG(CAboutDlg) //}}AFX_MSG DECLARE_MESSAGE_MAP() }; CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
JONATHAN TORRES ANGEL CHANGO

// DDX/DDV

52

UNIVERSIDAD TCNICA DE AMBATO

3RO B

{ //{{AFX_DATA_INIT(CAboutDlg) //}}AFX_DATA_INIT } void CAboutDlg::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(CAboutDlg) //}}AFX_DATA_MAP } BEGIN_MESSAGE_MAP(CAboutDlg, CDialog) //{{AFX_MSG_MAP(CAboutDlg) // No message handlers //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CNewDlg dialog CNewDlg::CNewDlg(CWnd* pParent /*=NULL*/) : CDialog(CNewDlg::IDD, pParent) { //{{AFX_DATA_INIT(CNewDlg) m_texto = _T(""); m_total = 0; m_r = 0; m_1 = _T(""); //}}AFX_DATA_INIT // Note that LoadIcon does not require a subsequent DestroyIcon in Win32 m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME); } void CNewDlg::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(CNewDlg) DDX_Text(pDX, IDC_EDIT1, m_texto); DDX_Text(pDX, IDC_EDIT2, m_total); DDX_Text(pDX, IDC_EDIT3, m_r); DDX_Text(pDX, IDC_RESPUESTA, m_1); //}}AFX_DATA_MAP } BEGIN_MESSAGE_MAP(CNewDlg, CDialog) //{{AFX_MSG_MAP(CNewDlg)
JONATHAN TORRES ANGEL CHANGO

53

UNIVERSIDAD TCNICA DE AMBATO

3RO B

ON_WM_SYSCOMMAND() ON_WM_PAINT() ON_WM_QUERYDRAGICON() ON_EN_CHANGE(IDC_EDIT1, OnChangeEdit1) ON_COMMAND(ID_FUNCION_CONTEOAUTOMATICO, OnFuncionConteoautomatico) ON_EN_CHANGE(IDC_EDIT2, OnChangeEdit2) //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CNewDlg message handlers BOOL CNewDlg::OnInitDialog() { CDialog::OnInitDialog(); // Add "About..." menu item to system menu. // IDM_ABOUTBOX must be in the system command range. ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX); ASSERT(IDM_ABOUTBOX < 0xF000); CMenu* pSysMenu = GetSystemMenu(FALSE); if (pSysMenu != NULL) { CString strAboutMenu; strAboutMenu.LoadString(IDS_ABOUTBOX); if (!strAboutMenu.IsEmpty()) { pSysMenu->AppendMenu(MF_SEPARATOR); pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu); } } // 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 } void CNewDlg::OnSysCommand(UINT nID, LPARAM lParam)
JONATHAN TORRES ANGEL CHANGO

54

UNIVERSIDAD TCNICA DE AMBATO

3RO B

{ if ((nID & 0xFFF0) == IDM_ABOUTBOX) { CAboutDlg dlgAbout; dlgAbout.DoModal(); } else { CDialog::OnSysCommand(nID, lParam); } } // 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 CNewDlg::OnPaint() { if (IsIconic()) { CPaintDC dc(this); // device context for painting SendMessage(WM_ICONERASEBKGND, 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 { CDialog::OnPaint(); } } // The system calls this to obtain the cursor to display while the user drags // the minimized window. HCURSOR CNewDlg::OnQueryDragIcon() { return (HCURSOR) m_hIcon;
JONATHAN TORRES ANGEL CHANGO

(WPARAM)

55

UNIVERSIDAD TCNICA DE AMBATO

3RO B

} void CNewDlg::OnChangeEdit1() { UpdateData(true); m_total=m_texto.GetLength(); SetWindowText(m_texto); m_1.Format("%d",m_total); UpdateData(false);

} void CNewDlg::OnFuncionConteoautomatico() { UpdateData(true); m_r=m_texto.GetLength(); UpdateData(false); }

JONATHAN TORRES ANGEL CHANGO

56

UNIVERSIDAD TCNICA DE AMBATO

3RO B

Gua para la eliminacin de caracteres

Dar doble clic en el icono para comenzar un nuevo proyecto.

Luego de dar doble clic en el icono enseguida dar clic en la opcin FILE y elegir nuevo.

JONATHAN TORRES ANGEL CHANGO

57

UNIVERSIDAD TCNICA DE AMBATO

3RO B

Para comenzar el proyecto es escoger el lugar donde se va a guardar el archivo y dar nombre al mismo que en este caso el archivo se llamara (ELIMINICIN DE CARACTERES).

Despus escoger la opcin MFC AppWizard (exe) que se necesita para la realizacin del proyecto.

JONATHAN TORRES ANGEL CHANGO

58

UNIVERSIDAD TCNICA DE AMBATO

3RO B

A continuacin para activar la aplicacin escoger la opcin de Dialog Basic y dar clic en FINISH

Automticamente la ventana de proyecto est lista para usarse.

JONATHAN TORRES ANGEL CHANGO

59

UNIVERSIDAD TCNICA DE AMBATO

3RO B

Proceder a ingresar los datos informativos en la ventana donde se va a realizar los ejercicios.

Inmediatamente ingresamos los EDIT BOX correspondientes donde van las variables y operaciones.

BOTONES

JONATHAN TORRES ANGEL CHANGO

60

UNIVERSIDAD TCNICA DE AMBATO

3RO B

Despues dar nombres a los botones en este caso el primer botn se llamara backspace y el segundo suprimir.

Para la realizacin del proyecto primero dar nombres a las variables que en este caso serian las opciones de los Edit. 1, 2, 3 respectivamente, oprimiendo (Ctrl+W), clic en la opcin MEMBER VARIABLES.

JONATHAN TORRES ANGEL CHANGO

61

UNIVERSIDAD TCNICA DE AMBATO

3RO B

Luego dar clic donde se va a dar nombre a la variable en realidad donde se va introducir los datos numricos en este caso del proyecto, despus de seleccionar dar clic en la opcin ADD VARIABLE

A continuacin de aparecer la ventana correspondiente procedimos a dar nombre a las variables que en este caso seria m_1, y seguidamente escoger el tipo de variable se va introducirse para ello dar clic en VARIABLE TYPE y escoger la opcin CString que este caso significa que se va ingresar letras para los cual se va a trabajar en este proyecto.

JONATHAN TORRES ANGEL CHANGO

62

UNIVERSIDAD TCNICA DE AMBATO

3RO B

As proseguir el mismo procedimiento con las dems opciones la variables se llamaran es si m_posicion, m_1 respectivamente pero en la variable m_posicion en este caso ira INT porque se va ingresar nmeros enteros.

Ahora se va ingresar un MEN que se llamara CONTEO ESCOJIDO AUTOMATICO, pero ello clic derecho en la parte superior izquierda de la ventana, opcin INSERT, luego clic en men y despus en NEW

JONATHAN TORRES ANGEL CHANGO

63

UNIVERSIDAD TCNICA DE AMBATO

3RO B

Automticamente se abre una ventana donde se insertara el men, el primer nombre ser funcin, y el otro se llamara CONTEO ESCOJIDO AUTOMATICO.

JONATHAN TORRES ANGEL CHANGO

64

UNIVERSIDAD TCNICA DE AMBATO

3RO B

Luego regresar a la pantalla principal y dar doble clic en el primer botn para la realizacin del proyecto e ingresar el cdigo necesario para que opere dicho programa en primer caso ser backspace.

Seguir el mismo procedimiento con el otro botn suprimir, pero en este caso cambiara de cdigo as:

JONATHAN TORRES ANGEL CHANGO

65

UNIVERSIDAD TCNICA DE AMBATO

3RO B

Ahora se habilitara el men ingresado anteriormente as mismo regresar a la ventana principal pero en este caso dar clic derecho en la ventana, opcin propiedades.

Dar clic en men, clic en la pestaa y clic en la opcin en la nica que esta.

JONATHAN TORRES ANGEL CHANGO

66

UNIVERSIDAD TCNICA DE AMBATO

3RO B

Despus de lo realizado anteriormente nuevamente oprimir (Crtl+w) esta vez para activar su comando o su funcin que va a realizar, clic en la opcin Message Maps, luego clic en el men creado anteriormente y doble clic en la opcin COMMAND y despues Edit code.

Dado clic en Edit code, para que realice la funcin ingresar el comando correspondiente.

JONATHAN TORRES ANGEL CHANGO

67

UNIVERSIDAD TCNICA DE AMBATO

3RO B

El programa le hacer correr y probar si todo funciona correctamente probando cada uno de los comandos que funcionen en cada Editbox, y tambin con su respectivo men ingresado anteriormente.

1). backspace

JONATHAN TORRES ANGEL CHANGO

68

UNIVERSIDAD TCNICA DE AMBATO

3RO B

2). Suprimir en esta opcin es diferente a la primera, aqu ingresar la posicin del carcter, y luego clic en el botn y se suprimir desde el carcter ingresado.

JONATHAN TORRES ANGEL CHANGO

69

UNIVERSIDAD TCNICA DE AMBATO

3RO B

3). En el carcter escogido aqu aparecer la letra borrada, est en funcin del botn suprimir, dar clic en el men funcin y luego clic en CONTEO ESCOJIDO AUTOMATICO, la letra aparecer automticamente.

As queda lista resuelto la operacin ELIMINACIN en el programa Microsoft Visual C++ 6.0, a continuacin presentaremos el cdigo completo que se origino a la realizacin de este archivo.

Cdigo completo // ELIMINACION DE CARACTERESDlg.cpp : implementation file // #include "stdafx.h" #include "ELIMINACION DE CARACTERES.h" #include "ELIMINACION DE CARACTERESDlg.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // CAboutDlg dialog used for App About
JONATHAN TORRES ANGEL CHANGO

70

UNIVERSIDAD TCNICA DE AMBATO

3RO B

class CAboutDlg : public CDialog { public: CAboutDlg(); // Dialog Data //{{AFX_DATA(CAboutDlg) enum { IDD = IDD_ABOUTBOX }; //}}AFX_DATA // ClassWizard generated virtual function overrides //{{AFX_VIRTUAL(CAboutDlg) protected: virtual void DoDataExchange(CDataExchange* pDX); //}}AFX_VIRTUAL // Implementation protected: //{{AFX_MSG(CAboutDlg) //}}AFX_MSG DECLARE_MESSAGE_MAP() }; CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD) { //{{AFX_DATA_INIT(CAboutDlg) //}}AFX_DATA_INIT } void CAboutDlg::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(CAboutDlg) //}}AFX_DATA_MAP } BEGIN_MESSAGE_MAP(CAboutDlg, CDialog) //{{AFX_MSG_MAP(CAboutDlg) // No message handlers //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CELIMINACIONDECARACTERESDlg dialog CELIMINACIONDECARACTERESDlg::CELIMINACIONDECARACTERESDlg(CW
JONATHAN TORRES ANGEL CHANGO

// DDX/DDV support

71

UNIVERSIDAD TCNICA DE AMBATO

3RO B

nd* pParent /*=NULL*/) : CDialog(CELIMINACIONDECARACTERESDlg::IDD, pParent) { //{{AFX_DATA_INIT(CELIMINACIONDECARACTERESDlg) m_texto = _T(""); m_posicion = 0; m_1 = _T(""); //}}AFX_DATA_INIT // Note that LoadIcon does not require a subsequent DestroyIcon in Win32 m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME); } void pDX) { CELIMINACIONDECARACTERESDlg::DoDataExchange(CDataExchange*

CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(CELIMINACIONDECARACTERESDlg) DDX_Text(pDX, IDC_EDIT1, m_texto); DDX_Text(pDX, IDC_EDIT2, m_posicion); DDX_Text(pDX, IDC_EDIT3, m_1); //}}AFX_DATA_MAP } BEGIN_MESSAGE_MAP(CELIMINACIONDECARACTERESDlg, CDialog) //{{AFX_MSG_MAP(CELIMINACIONDECARACTERESDlg) ON_WM_SYSCOMMAND() ON_WM_PAINT() ON_WM_QUERYDRAGICON() ON_BN_CLICKED(IDC_BUTTON1, OnButton1) ON_BN_CLICKED(IDC_BUTTON2, OnButton2) ON_COMMAND(ID_FUNCION_CONTEOESCOJIDOAUTOMATICO, OnFuncionConteoescojidoautomatico) //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CELIMINACIONDECARACTERESDlg message handlers BOOL CELIMINACIONDECARACTERESDlg::OnInitDialog() { CDialog::OnInitDialog(); // Add "About..." menu item to system menu. // IDM_ABOUTBOX must be in the system command range. ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX); ASSERT(IDM_ABOUTBOX < 0xF000);
JONATHAN TORRES ANGEL CHANGO

72

UNIVERSIDAD TCNICA DE AMBATO

3RO B

CMenu* pSysMenu = GetSystemMenu(FALSE); if (pSysMenu != NULL) { CString strAboutMenu; strAboutMenu.LoadString(IDS_ABOUTBOX); if (!strAboutMenu.IsEmpty()) { pSysMenu->AppendMenu(MF_SEPARATOR); pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu); } } // 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 } void CELIMINACIONDECARACTERESDlg::OnSysCommand(UINT nID, LPARAM lParam) { if ((nID & 0xFFF0) == IDM_ABOUTBOX) { CAboutDlg dlgAbout; dlgAbout.DoModal(); } else { CDialog::OnSysCommand(nID, lParam); } } // 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 CELIMINACIONDECARACTERESDlg::OnPaint() { if (IsIconic()) { CPaintDC dc(this); // device context for painting
JONATHAN TORRES ANGEL CHANGO

73

UNIVERSIDAD TCNICA DE AMBATO

3RO B

SendMessage(WM_ICONERASEBKGND, 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 { CDialog::OnPaint(); } }

(WPARAM)

// The system calls this to obtain the cursor to display while the user drags // the minimized window. HCURSOR CELIMINACIONDECARACTERESDlg::OnQueryDragIcon() { return (HCURSOR) m_hIcon; } void CELIMINACIONDECARACTERESDlg::OnButton1() { UpdateData(true); int z; z=m_texto.GetLength(); m_texto.Delete(z-1); UpdateData(false); } void CELIMINACIONDECARACTERESDlg::OnButton2() { UpdateData(true); m_texto.Delete(m_posicion-1); UpdateData(false); } void CELIMINACIONDECARACTERESDlg::OnFuncionConteoescojidoautomatico() {
JONATHAN TORRES ANGEL CHANGO

74

UNIVERSIDAD TCNICA DE AMBATO

3RO B

UpdateData(true); int z; z=m_posicion-1; m_1=m_texto.GetAt(z); UpdateData(false); }

JONATHAN TORRES ANGEL CHANGO

75

UNIVERSIDAD TCNICA DE AMBATO

3RO B

Gua para transformar texto en Maysculas y Minsculas con MENS.

Dar doble clic en el icono para comenzar un nuevo proyecto.

Luego de dar doble clic en el icono enseguida dar clic en la opcin FILE y elegir nuevo.

Para comenzar el proyecto es escoger el lugar donde se va a guardar el archivo y dar nombre al mismo que en este caso el archivo se llamara (MAYSCULAS).

JONATHAN TORRES ANGEL CHANGO

76

UNIVERSIDAD TCNICA DE AMBATO

3RO B

A continuacin para activar la aplicacin escoger la opcin de Dialog Basic y dar clic en FINISH

JONATHAN TORRES ANGEL CHANGO

77

UNIVERSIDAD TCNICA DE AMBATO

3RO B

Automticamente la ventana de proyecto est lista para usarse.

Proceder a ingresar los datos informativos en la ventana donde se va a realizar los ejercicios.

JONATHAN TORRES ANGEL CHANGO

78

UNIVERSIDAD TCNICA DE AMBATO

3RO B

Inmediatamente ingresamos los EDIT BOX, correspondientes donde van las variables y operaciones.

Para la realizacin del proyecto primero dar nombres a las variables que en este caso serian las opciones de los Edit. 1, 2, 3 respectivamente, oprimiendo (Ctrl+W), clic en la opcin MEMBER VARIABLES.

JONATHAN TORRES ANGEL CHANGO

79

UNIVERSIDAD TCNICA DE AMBATO

3RO B

Luego dar clic donde se va a dar nombre a la variable en realidad donde se va introducir los datos numricos en este caso del proyecto, despus de seleccionar dar clic en la opcin ADD VARIABLE , e ingresar el nombre de las variables.

Ahora se va ingresar un MEN que se llamara CONTEO ESCOJIDO AUTOMATICO, pero ello clic derecho en la parte superior izquierda de la ventana, opcin INSERT, luego clic en men y despus en NEW

JONATHAN TORRES ANGEL CHANGO

80

UNIVERSIDAD TCNICA DE AMBATO

3RO B

Automticamente se abre una ventana donde se insertara el men, el primer nombre ser funcin, y el otro se llamara CONTEO ESCOJIDO AUTOMATICO, en este caso se aadir otro men llamado ACCIONES donde incluir en ella varias opciones.

JONATHAN TORRES ANGEL CHANGO

81

UNIVERSIDAD TCNICA DE AMBATO

3RO B

Luego regresar a la pantalla principal y dar doble clic en el primer BOTN para la realizacin del proyecto e ingresar el cdigo necesario para que opere dicho programa.

Realizar el mismo procedimiento con el otro botn el cdigo es:

JONATHAN TORRES ANGEL CHANGO

82

UNIVERSIDAD TCNICA DE AMBATO

3RO B

Ahora se habilitara el men ingresado anteriormente as mismo regresar a la ventana principal pero en este caso dar clic derecho en la ventana, opcin propiedades.

Dar clic en men, clic en la pestaa y clic en la opcin en la nica que esta.

JONATHAN TORRES ANGEL CHANGO

83

UNIVERSIDAD TCNICA DE AMBATO

3RO B

Despus de lo realizado anteriormente nuevamente oprimir (Crtl+w) esta vez para activar su comando o su funcin que va a realizar, clic en la opcin Message Maps, luego clic en el men creado anteriormente y doble clic en la opcin COMMAND y despues Edit code.

Dado clic en Edit code, para que realice la funcin ingresar el comando correspondiente.

JONATHAN TORRES ANGEL CHANGO

84

UNIVERSIDAD TCNICA DE AMBATO

3RO B

El mismo procedimiento lo hacen con las dems opciones que se insertaron en el men con los siguientes cdigos. UpdateData(true); m_r=m_accion; m_r.MakeUpper(); UpdateData(false); UpdateData(true); m_r=m_accion; m_r.MakeLower(); UpdateData(false); ShowWindow(SW_MAXIMIZE) ShowWindow(SW_MINIMIZE); ShowWindow(SW_RESTORE); exit(0);

Cdigos para men Maysculas

Minsculas

Maximizar Minimizar Restaurar Cerrar

JONATHAN TORRES ANGEL CHANGO

85

UNIVERSIDAD TCNICA DE AMBATO

3RO B

El programa le hacer correr y probar si todo funciona correctamente probando cada uno de los comandos que funcionen en cada Editbox, y tambin con su respectivo men ingresado anteriormente.

1). Ingresando una palabra y mayscula

1). Ingresando una palabra y minscula

JONATHAN TORRES ANGEL CHANGO

86

UNIVERSIDAD TCNICA DE AMBATO

3RO B

Comando que funciona con Men

1). MAYSCULA

2). MINSCULA

3). MAXIMIZAR

JONATHAN TORRES ANGEL CHANGO

87

UNIVERSIDAD TCNICA DE AMBATO

3RO B

4). MINIMIZAR

5). RESATURAR

6). CERRAR Esta opcin cierra el programa

As queda lista resuelto la operacin MAYSCULAS en el programa Microsoft Visual C++ 6.0, a continuacin presentaremos el cdigo completo que se origino a la realizacin de este archivo.

Cdigo Completo // mayusculasDlg.cpp : implementation file // #include "stdafx.h" #include "mayusculas.h" #include "mayusculasDlg.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__;
JONATHAN TORRES ANGEL CHANGO

88

UNIVERSIDAD TCNICA DE AMBATO

3RO B

#endif ///////////////////////////////////////////////////////////////////////////// // CAboutDlg dialog used for App About class CAboutDlg : public CDialog { public: CAboutDlg(); // Dialog Data //{{AFX_DATA(CAboutDlg) enum { IDD = IDD_ABOUTBOX }; //}}AFX_DATA // ClassWizard generated virtual function overrides //{{AFX_VIRTUAL(CAboutDlg) protected: virtual void DoDataExchange(CDataExchange* pDX); //}}AFX_VIRTUAL // Implementation protected: //{{AFX_MSG(CAboutDlg) //}}AFX_MSG DECLARE_MESSAGE_MAP() }; CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD) { //{{AFX_DATA_INIT(CAboutDlg) //}}AFX_DATA_INIT } void CAboutDlg::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(CAboutDlg) //}}AFX_DATA_MAP } BEGIN_MESSAGE_MAP(CAboutDlg, CDialog) //{{AFX_MSG_MAP(CAboutDlg) // No message handlers //}}AFX_MSG_MAP END_MESSAGE_MAP()
JONATHAN TORRES ANGEL CHANGO

// DDX/DDV support

89

UNIVERSIDAD TCNICA DE AMBATO

3RO B

///////////////////////////////////////////////////////////////////////////// // CMayusculasDlg dialog CMayusculasDlg::CMayusculasDlg(CWnd* pParent /*=NULL*/) : CDialog(CMayusculasDlg::IDD, pParent) { //{{AFX_DATA_INIT(CMayusculasDlg) m_accion = _T(""); m_texto = _T(""); m_r = _T(""); //}}AFX_DATA_INIT // Note that LoadIcon does not require a subsequent DestroyIcon in Win32 m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME); } void CMayusculasDlg::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(CMayusculasDlg) DDX_Text(pDX, IDC_EDIT1, m_accion); DDX_Text(pDX, IDC_EDIT2, m_texto); DDX_Text(pDX, IDC_EDIT3, m_r); //}}AFX_DATA_MAP } BEGIN_MESSAGE_MAP(CMayusculasDlg, CDialog) //{{AFX_MSG_MAP(CMayusculasDlg) ON_WM_SYSCOMMAND() ON_WM_PAINT() ON_WM_QUERYDRAGICON() ON_BN_CLICKED(IDC_BUTTON2, OnButton2) ON_BN_CLICKED(IDC_BUTTON3, OnButton3) ON_COMMAND(ID_FUNCION_MAYUSCULAS, OnFuncionMayusculas) ON_COMMAND(ID_FUNCION_MINUSCULAS, OnFuncionMinusculas) ON_EN_CHANGE(IDC_EDIT3, OnChangeEdit3) ON_COMMAND(ID_ACCIONES_CERRAR, OnAccionesCerrar) ON_COMMAND(ID_ACCIONES_MAXIMIZAR, OnAccionesMaximizar) ON_COMMAND(ID_ACCIONES_MINIMIZAR, OnAccionesMinimizar) ON_COMMAND(ID_ACCIONES_RESTAURAR, OnAccionesRestaurar) ON_EN_CHANGE(IDC_EDIT2, OnChangeEdit2) //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CMayusculasDlg message handlers BOOL CMayusculasDlg::OnInitDialog()
JONATHAN TORRES ANGEL CHANGO

90

UNIVERSIDAD TCNICA DE AMBATO

3RO B

{ CDialog::OnInitDialog(); // Add "About..." menu item to system menu. // IDM_ABOUTBOX must be in the system command range. ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX); ASSERT(IDM_ABOUTBOX < 0xF000); CMenu* pSysMenu = GetSystemMenu(FALSE); if (pSysMenu != NULL) { CString strAboutMenu; strAboutMenu.LoadString(IDS_ABOUTBOX); if (!strAboutMenu.IsEmpty()) { pSysMenu->AppendMenu(MF_SEPARATOR); pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu); } } // 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 } void CMayusculasDlg::OnSysCommand(UINT nID, LPARAM lParam) { if ((nID & 0xFFF0) == IDM_ABOUTBOX) { CAboutDlg dlgAbout; dlgAbout.DoModal(); } else { CDialog::OnSysCommand(nID, lParam); } } // 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,
JONATHAN TORRES ANGEL CHANGO

91

UNIVERSIDAD TCNICA DE AMBATO

3RO B

// this is automatically done for you by the framework. void CMayusculasDlg::OnPaint() { if (IsIconic()) { CPaintDC dc(this); // device context for painting SendMessage(WM_ICONERASEBKGND, 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 { CDialog::OnPaint(); } } // The system calls this to obtain the cursor to display while the user drags // the minimized window. HCURSOR CMayusculasDlg::OnQueryDragIcon() { return (HCURSOR) m_hIcon; } void CMayusculasDlg::OnButton2() { UpdateData(true); m_accion=m_texto; m_accion.MakeUpper(); UpdateData(false); } void CMayusculasDlg::OnButton3() { UpdateData(true);
JONATHAN TORRES ANGEL CHANGO

(WPARAM)

92

UNIVERSIDAD TCNICA DE AMBATO

3RO B

m_accion=m_texto; m_accion.MakeLower(); UpdateData(false); } void CMayusculasDlg::OnFuncionMayusculas() { UpdateData(true); m_r=m_accion; m_r.MakeUpper(); UpdateData(false); } void CMayusculasDlg::OnFuncionMinusculas() { UpdateData(true); m_r=m_accion; m_r.MakeLower(); UpdateData(false); }

void CMayusculasDlg::OnAccionesCerrar() { exit(0); } void CMayusculasDlg::OnAccionesMaximizar() { ShowWindow(SW_MAXIMIZE); } void CMayusculasDlg::OnAccionesMinimizar() { ShowWindow(SW_MINIMIZE); } void CMayusculasDlg::OnAccionesRestaurar() { ShowWindow(SW_RESTORE); }

JONATHAN TORRES ANGEL CHANGO

93

UNIVERSIDAD TCNICA DE AMBATO

3RO B

7. Conclusiones - Las guas se elaboraron de manera eficaz de manera que en cada una de ella se especifica paso a paso la resolucin de cada programa ejecutable. - Se pudo verificar que con la correcta instalacin del programa Visual C++, se
ejecuto con eficacia las operaciones bsicas, como son: suma, resta, multiplicacin, divisin. - Con los diferentes comandos de ejecucin fueron de vital eficacia su ingreso correcto para no tener inconvenientes (errores de ejecucin),y as obtener un buen resultado - Una vez abre acabado la ejecucin del programa se pudo notar que la ejecucin se dio con un buen resultado, y resultados favorables al momento de sacar los respectivos resultados

- En la aplicacin de los cdigos, los programas ejecutables se desarrollaron de un orden eficiente, mejorando la visualizacin de los contenidos de cada ejecucin. - El desarrollo personalizado de los programas ejecutable, se dieron de un excelente ejecucin en cada uno, como se especifica en las guas. - Los programas se ejecutaron de manera eficaz y precisa, de modo que no se tuvo errores en el proceso. - Los grficos que se presentan en cada una de las gua especifican el desenvolvimiento de cada una de los programas ejecutables. 8. Recomendaciones - Se recomienda tener cuidado al momento de ingresar los diferentes cdigo y comandos para cada una de las funciones requeridas, ya que al no hacerlos corre el riesgo de barios errores a la vez dificultando su desarrollo y por ende su ejecucin. - Una vez que se ha concluido con la ejecucin de cada uno de los programas, se recomienda verificar su ubicacin o lugar en que se los ha guardado para poder tenerlos a nuestra disposicin. - Se sugiere que los programas ejecutables que se han creado, se verifiquen con todo y cada uno de sus caractersticas personales tales como; Titulo, Subttulos, y descripcin personal, etc., para que se pueda reconocer que programa se ejecuta.

JONATHAN TORRES ANGEL CHANGO

94

UNIVERSIDAD TCNICA DE AMBATO

3RO B

9. Bibliografa - Manual de operaciones y cdigos para Microsoft Visual C++ 6.0. - Basados en los comandos proporcionados por el Ing. Fabin Morales

10. Anexos

JONATHAN TORRES ANGEL CHANGO

95

Potrebbero piacerti anche