UNIVERSIDAD CAPITAN GENERAL GERARDO BARRIOS
FACULTAD DE CIENCIA Y TECNOLOGIA
UGB
CATEDRA COMPILADORES E INTÉRPRETES
DOCENTE: Lic Edwin
Tema: Información de Aplicación PC Auditor-UGB
Integrantes :
Mariela Nataly Urquilla Velásquez
Daniel Duran
Cinthya Tatiana Mejía
Carlos David Calderón
Luis Manuel Calero Flores
Erick Noe Aguiñada Cruz
Fecha de entrega: 12 de marzo de 2012
PC Auditor-UGB- INFORMACION DE LA APLICACIÓN
Pantalla Principal
Descripción de la aplicación: Esta aplicación creada en C# permite visualizar de
manera ordenada información básica del sistema en lo correspondiente a sus
componentes, motherboard, procesador, información del monito / pantallas
conectadas, tarjeta de video, codegs de audio, almacenamiento, redes y una lista del
software instalado en el PC
Menu
El menú (Menú) está constituido de las opciones chequeo rápido que abre la ventana Vista Rápida
Además del la opción de Salir del la aplicación
Además del la opción de acerca de que muestra un mensaje de quienes realizaron la aplicacion
Menú principal
Acceso a la pantalla de
Vista rapida de
informacion Area de informacion de
Hardware/Software Barra de estado
Muestra de
información
Varible
Ventana de vista rápida de información del sistema
Descripcion : en esta ventana de la aplicación se aprecian la información más
importante del sistema de manera rápida
LA APLICACIÓN DESDE ADENTRO INTERFAZ/ CODIGO
PANTALLA PRINCIPAL
TIPO DE APLICACIÓN: WINDOWS FORM
AREAS DE LA APLICACIÓN : PANTALLA PRINCIPAL Y VISTA RAPIDA
VERSIONDE VISUAL STUDIO UTILIZADA: VISUAL STUDIO 2010
CONTROLES UTILIZADOS: ListBox, Link label, Label, MenuStrip,PictureBox,StatusTrip, Button
CLASES UTILIZADAS EN LA APLICACIÓN (CODIGO)
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using System.Collections; using InfoSistema; using System.Management; using System.Management.Instrumentation; using System.IO; using Microsoft.Win32; API NECESARIAS PARA OBTENER INFORMACION DEL SISTEMA WIN 32 Utilizada en la mayor parte de la aplicacion
Ejemplo de uso del api win 32 (en este caso se obtiene información del disco duro
MODO DE USO DEL API WIN 32 PRIMERO SE DECLARA Y SE INSTANCIAN LOS MANEJADORES // Declaracion de los objetos del api win32 para obtener la informacion // de la placa madre , configuracion de arranque, procesador, SO,escritorio, monitor,bateria y //codegs deaudio public static ArrayList MOBO_Info = new ArrayList(); ManagementObjectSearcher mos = new ManagementObjectSearcher( "root\\CIMV2", "SELECT * FROM Win32_BaseBoard"); ManagementObjectSearcher mos10 = new ManagementObjectSearcher( "root\\CIMV2", "SELECT * FROM Win32_BootConfiguration"); ManagementObjectSearcher mos2 = new ManagementObjectSearcher( "root\\CIMV2", "SELECT * FROM Win32_Processor"); ManagementObjectSearcher mos3 = new ManagementObjectSearcher( "root\\CIMV2", "SELECT * FROM Win32_OperatingSystem"); ManagementObjectSearcher mos4 = new ManagementObjectSearcher( "root\\CIMV2", "SELECT * FROM Win32_Desktop"); ManagementObjectSearcher mos5 = new ManagementObjectSearcher( "root\\CIMV2", "SELECT * FROM Win32_DesktopMonitor"); ManagementObjectSearcher mos7 = new ManagementObjectSearcher( "root\\CIMV2", "SELECT * FROM Win32_BIOS"); ManagementObjectSearcher mos6 = new ManagementObjectSearcher( "root\\CIMV2", "SELECT * FROM Win32_Battery"); ManagementObjectSearcher mos20 = new ManagementObjectSearcher( "root\\CIMV2", "SELECT * FROM Win32_CodecFile");
Interfaz de visual studio que muestra la declararion de los objetos
MOSTRAR INFORMACION EN EL CONTROL LISTBOX(código)
private void linkLabel2_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { // CODIGO QUE PERMITE MOSTRAR INFORMACION EN EL LISTBOX DE LA MOTHERBOARD listBox1.Items.Clear();// se limpia el listbox this.Text = " PCAuditor-UGB-Tarjeta Madre ";// titulo form label2.Text = " Tarjeta Madre ";// titulo del labe toolStripStatusLabel3.Text = " Tarjeta Madre"; // SE RECORRE EL OBJETO INSTANCIADO DE LA CLASE WIN32 foreach (ManagementObject mo in mos.Get()) { try { // SE MUESTRAN LOS ITEMS RECOLECTADOS CON LA INFORMACION listBox1.Items.Add("Caption: " + mo.GetPropertyValue("Caption").ToString()); listBox1.Items.Add("Nombre del dispositivo: " + mo.GetPropertyValue("Name").ToString()); listBox1.Items.Add("Nombre del clase de creacion: " + mo.GetPropertyValue("CreationClassName").ToString()); listBox1.Items.Add("Descripcion: " + mo.GetPropertyValue("Description").ToString()); listBox1.Items.Add("Producto: " + mo.GetPropertyValue("Product").ToString()); //listBox1.Items.Add("Fecha de Instalacion: " + mo.GetPropertyValue("InstallDate").ToString()); listBox1.Items.Add("Numero de Serie: " + mo.GetPropertyValue("SerialNumber").ToString()); listBox1.Items.Add("Version: " + mo.GetPropertyValue("Version").ToString()); listBox1.Items.Add("Status: " + mo.GetPropertyValue("Status").ToString()); //listBox1.Items.Add("Ancho dispositivo: " + mo.GetPropertyValue("Width").ToString()); //listBox1.Items.Add("Alto de dispositivo :" + mo.GetPropertyValue("Weight").ToString()); listBox1.Items.Add("Manufacturacion: " + mo.GetPropertyValue("Manufacturer").ToString()); listBox1.Items.Add("Nombre Procesador :" + info.NombreProcesador); listBox1.Items.Add("Fabricante de Procesador:" + info.FabricanteProcesador); listBox1.Items.Add("Cantidad de procesadores :" + info.CantidadProcesadores); listBox1.Items.Add("L2CacheProcesador :" + info.L2CacheProcesador); listBox1.Items.Add("L3CacheProcesador :" + info.L3CacheProcesador); listBox1.Items.Add("Velocidad de procesador :" + info.VelocidadProcesador); listBox1.Items.Add("Velocidad Maxima de procesador :" + info.MaxVelocidadProcesador); } catch { } }
MOSTRANDO INFORMACION EN EL LISTBOX (INTERFAZ)
Al seleccionar cualquiera de los ítems de la izquierda automáticamente se presentara la
información en el listbox de la derecha y cambiaran los títulos del formulario y de la barra de
estado (Mecánica que se repite en todos los ítems)
Mostrando información en el listbox de los demás ítems
LA APLICACIÓN DESDE ADENTRO INTERFAZ/ CODIGO
VENTANA VISTA RAPIDA
VERSIONDE VISUAL STUDIO UTILIZADA: VISUAL STUDIO 2010
CONTROLES UTILIZADOS: Link label, Label, Windows form
CLASES UTILIZADAS EN LA APLICACIÓN (CODIGO)
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using System.Collections; using InfoSistema; using System.Management; using System.Management.Instrumentation; using System.IO; using Microsoft.Win32; API NECESARIAS PARA OBTENER INFORMACION DEL SISTEMA WIN 32 Utilizada en la mayor parte de la aplicación
Vista en ejecucion Vista en diseño
VENTANA VISTA RAPIDA
Código ventana rápida
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using InfoSistema; using System.Management; using System.Management.Instrumentation; using System.IO; using Microsoft.Win32; namespace HWcontrol { public partial class Mostrar : Form { public Mostrar() { InitializeComponent(); } irInforSistema info = new irInforSistema();// se crea una instancia de la clase info sistema necesaria para obtener informacion private static Mostrar m_FormDefInstance; public static Mostrar DefInstance { get { if (m_FormDefInstance == null || m_FormDefInstance.IsDisposed) m_FormDefInstance = new Mostrar(); return m_FormDefInstance; } set { m_FormDefInstance = value; } } // declaracion e instansacion de la clase win32 ManagementObjectSearcher mos = new ManagementObjectSearcher( "root\\CIMV2", "SELECT * FROM Win32_BaseBoard"); ManagementObjectSearcher mos2 = new ManagementObjectSearcher( "root\\CIMV2", "SELECT * FROM Win32_Battery"); // codigo en el evento load del formulario mostrar // que nos permite mostrar la infomacion en los labels del formulario private void Mostrar_Load(object sender, EventArgs e) { //mostrando informacion en los labels label2.Text = "Nombre de pc :" + info.NombreComputador; label4.Text = "Fabricante de pc :" + info.FabricanteComputador; label5.Text = "NetBios : " + Environment.UserDomainName; label6.Text = "SO : " + info.NombreSistemaOperativo; label7.Text = "Version : " + info.VersionSistemaOperativo; label8.Text = "Idioma : " + System.Globalization.CultureInfo.CurrentCulture; foreach (ManagementObject mo in mos.Get()) { try
{ label9.Text = "Nombre del dispositivo: " + mo.GetPropertyValue("Name").ToString(); label10.Text = "Nombre del clase de creacion: " + mo.GetPropertyValue("CreationClassName").ToString(); label11.Text = "Descripcion: " + mo.GetPropertyValue("Description").ToString(); label12.Text = "Fabricante: " + mo.GetPropertyValue("Manufacturer").ToString(); //listBox1.Items.Add("Fecha de Instalacion: " + mo.GetPropertyValue("InstallDate").ToString()); label13.Text = "Numero de Serie: " + mo.GetPropertyValue("SerialNumber").ToString(); label14.Text = "Version: " + mo.GetPropertyValue("Version").ToString(); label15.Text = "Status: " + mo.GetPropertyValue("Status").ToString(); //listBox1.Items.Add("Ancho dispositivo: " + mo.GetPropertyValue("Width").ToString()); //listBox1.Items.Add("Alto de dispositivo :" + mo.GetPropertyValue("Weight").ToString()); label16.Text = "Nombre : " + info.NombreProcesador; label20.Text = "Cantidad : " + info.CantidadProcesadores; label18.Text = "Fabricante : " + info.FabricanteProcesador; label19.Text = "Velocidad : " + info.VelocidadProcesador; label21.Text = "Maxima Velocidad : " + info.MaxVelocidadProcesador; label22.Text = "Modelo : " + info.ModeloDiscoDuro; label24.Text = "Unidad intalado el SO : " + info.UnidadDelDiscoInstaladoSO; label25.Text = "Total de Memoria : " + info.TotalDiscoDuro; label26.Text = " C : " + info.MemoriaLibreenC; label27.Text = " D : " + info.MemoriaLibreenD; label23.Text = " Tipo : " + info.FabricanteDiscoDuro; } catch { } } foreach (ManagementObject mo in mos2.Get()) { try { label33.Text = "Nombre: " + mo.GetPropertyValue("Name").ToString(); label36.Text = "Descripcion: "+mo.GetPropertyValue("Description").ToString(); label39.Text = "Status : " + mo.GetPropertyValue("Status").ToString(); label40.Text = "Tiempo de bateria: " + Convert.ToInt32(mo.GetPropertyValue("TimeOnBattery")); label34.Text = "Voltaje: " + Convert.ToInt32(mo.GetPropertyValue("DesignVoltage")); label35.Text = "Vida: " + Convert.ToInt32(mo.GetPropertyValue("DesignCapacity")); } catch { } }
try { DriveInfo drive = new DriveInfo("E"); DriveInfo drive2 = new DriveInfo("G"); DriveInfo drive3 = new DriveInfo("C"); label28.Text = "Nombre :" + drive2.Name; label29.Text ="Tipo :" + drive2.DriveType; label30.Text ="Etiqueta :" + drive2.VolumeLabel; label31.Text ="Capacidad :" + drive2.TotalSize; label32.Text ="Espacio :" + drive2.TotalFreeSpace; label37.Text = "Directorio :" + drive2.RootDirectory; label38.Text = "Formato :" + drive2.DriveFormat; label41.Text = "Etiqueta Unidad Dvd-RW :" + drive.Name; label42.Text = "Tipo de unidad :" + drive.DriveType; label43.Text = "Estado :" + drive.IsReady; label44.Text = "Raiz :" + drive.RootDirectory; } catch { label38.Text = "No se encontraron otros dispositivos "; } } // codigo del linklabel salir private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { if (DialogResult.Yes == MessageBox.Show("Realmente desea salir de la aplicacion", "PCAuditorUGB v1.0", MessageBoxButtons.YesNo)) { this.Close(); } } } }
MENSAJES QUE MUESTRA LA APLICACIÓN
En las opciones del la aplicación donde se muestran mensajes son en las de acerca de y la
opción salir
Código de Acerca de
private void acercaToolStripMenuItem_Click(object sender, EventArgs e) { MessageBox.Show("Proyecto Realizado para compiladores e interpretes ugb 2012", "PCAuditorUGB v1.0- Acerca de...", MessageBoxButtons.OK, MessageBoxIcon.Information); }
Opcion Salir
Código
if (DialogResult.Yes == MessageBox.Show("Realmente desea salir de la aplicacion", "PCAuditorUGB v1.0", MessageBoxButtons.YesNo)) { this.Close(); }