这是错误似乎是错误的代码,我不明白为什么:
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.Runtime.InteropServices;
namespace WindowsFormsApplication6
{
public partial class Form1 : Form
{
[DllImport("nvcpl.dll", EntryPoint = "NvCplGetThermalSettings")]
private static extern bool NvCplGetThermalSettings(
UInt32 nWindowsMonitorNumber, out UInt32 pdwCoreTemp, out UInt32 pdwAmbientTemp, out UInt32 pdwUpperLimit);
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
}
public UInt32 GetNVidiaCardTemperature(int monitorNumber)
{
UInt32 coreTemp = 0;
UInt32 ambientTemp = 0;
UInt32 upperLimit = 0;
if (NvCplGetThermalSettings(0, out coreTemp, out ambientTemp, out upperLimit))
return coreTemp;
else
return 0;
}
private void button1_Click(object sender, EventArgs e)
{
MessageBox.Show(GetNVidiaCardTemperature(0).ToString());
}
}
}
错误在线:
if (NvCplGetThermalSettings(0, out coreTemp, out ambientTemp, out upperLimit))
错误是:
无法加载DLL'nvcpl.dll':指定的模块无法加载 找到。 (HRESULT异常:0x8007007E)
任何想法为什么它起作用? 单击按钮时出现错误。