Foros del Web » Programando para Internet » ASPX (.net) »

No se puede cargar el archivo DLL 'Core.dll': No se puede encontrar el módulo especif

Estas en el tema de No se puede cargar el archivo DLL 'Core.dll': No se puede encontrar el módulo especif en el foro de ASPX (.net) en Foros del Web. Hola, estoy intentando crear un programa en c# para obtener la memoria fisica, virtual y paginada consumida o restante. Éste es el código: form1.cs: using ...
  #1 (permalink)  
Antiguo 03/08/2012, 03:14
 
Fecha de Ingreso: diciembre-2008
Mensajes: 21
Antigüedad: 15 años, 4 meses
Puntos: 0
No se puede cargar el archivo DLL 'Core.dll': No se puede encontrar el módulo especif

Hola, estoy intentando crear un programa en c# para obtener la memoria fisica, virtual y paginada consumida o restante.

Éste es el código:
form1.cs:

using System;
using System.Runtime.InteropServices;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Text;

namespace PruebasObtenerMemoria
{
/// <summary>
/// Descripción breve de Form1.
/// </summary>
public class Form1 : System.Windows.Forms.Form
{
private System.Windows.Forms.Button btnMostrar;
private System.Windows.Forms.TextBox txtMostrar;
/// <summary>
/// Variable del diseñador requerida.
/// </summary>
private System.ComponentModel.Container components = null;

public Form1()
{
InitializeComponent();
}


protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}

private void InitializeComponent()
{
this.btnMostrar = new System.Windows.Forms.Button();
this.txtMostrar = new System.Windows.Forms.TextBox();
this.SuspendLayout();
this.btnMostrar.Location = new System.Drawing.Point(136 , 184);
this.btnMostrar.Name = "btnMostrar";
this.btnMostrar.TabIndex = 0;
this.btnMostrar.Text = "Mostrar";
this.btnMostrar.Click += new System.EventHandler(this.btnMostrar_Click);
this.txtMostrar.Location = new System.Drawing.Point(80, 40);
this.txtMostrar.Multiline = true;
this.txtMostrar.Name = "txtMostrar";
this.txtMostrar.Size = new System.Drawing.Size(128, 128);
this.txtMostrar.TabIndex = 1;
this.txtMostrar.Text = "textBox1";
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(284, 262);
this.Controls.Add(this.txtMostrar);
this.Controls.Add(this.btnMostrar);
this.Name = "Form1";
this.Text = "Form1";
this.ResumeLayout(false);

}
[STAThread]
static void Main()
{
Application.Run(new Form1());
}


private void btnMostrar_Click(object sender, System.EventArgs e)
{
Memoria mem = new Memoria();
txtMostrar.Text = mem.ShowMemory();
}

}
}



y la clase Memoria.cs:

using System;
using System.Runtime.InteropServices;
using System.Text;


namespace PruebasObtenerMemoria
{
/// <summary>
/// Descripción breve de Memoria.
/// </summary>
public class Memoria
{
public struct MEMORYSTATUS //Estructura para obtener las memorias totales y disponibles
{
public uint dwLength;
public uint dwMemoryLoad;
public uint dwTotalPhys;
public uint dwAvailPhys;
public uint dwTotalPageFile;
public uint dwAvailPageFile;
public uint dwTotalVirtual;
public uint dwAvailVirtual;
}

[DllImport("Core.dll")] //Importamos coreDll donde se encuentra GlobalMemoryStatus.
public static extern void GlobalMemoryStatus(MEMORYSTATUS lpBuffer); //Funcion GlobalMemoryStatus.

/*[DllImport("Core.dll")]
public static extern int GetSystemMemoryDivision
(
ref uint lpdwStorePages, //Número de páginas dedicadas a almacenar
ref uint lpdwRamPages, //Número de páginas dedicadas al sistema de memoria
ref uint lpdwPageSize //Número de Bytes para cada página
);

public string ShowMemory()
{
/* uint storePages = 0; //Inicializamos valores
uint ramPages = 0;
uint pageSize = 0;
int res = GetSystemMemoryDivision(ref storePages, ref ramPages, ref pageSize);

MEMORYSTATUS memStatus = new MEMORYSTATUS();
StringBuilder MemoryInfo = new StringBuilder();
MemoryInfo.Append("Memory Load: "
+ memStatus.dwMemoryLoad.ToString() + "\n");
MemoryInfo.Append("Total Physical: "
+ memStatus.dwTotalPhys.ToString() + "\n");
MemoryInfo.Append("Avail Physical: "
+ memStatus.dwAvailPhys.ToString() + "\n");
MemoryInfo.Append("Total Page File: "
+ memStatus.dwTotalPageFile.ToString() + "\n");
MemoryInfo.Append("Avail Page File: "
+ memStatus.dwAvailPageFile.ToString() + "\n");*/
MemoryInfo.Append("Total Virtual: "
+ memStatus.dwTotalVirtual.ToString() + "\n");
MemoryInfo.Append("Avail Virtual: "
+ memStatus.dwAvailVirtual.ToString() + "\n");

// Show the available memory.
return MemoryInfo.ToString();
}
}
}



La cuestión, es que al clickar el botón me da el siguiente error de excepción:

No se puede cargar el archivo DLL 'Core.dll': No se puede encontrar el módulo especificado. (Excepción de HRESULT: 0x8007007E)

El archivo System.Core.dll está en la carpeta System32 y no sé donde puede estar el error.

A ver si alguien puede ayudarme.Gracias.

Etiquetas: dll, encontrar, textbox
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 06:23.