搜索 microsoft.windowsmediaservices.dll 然后,添加引用时通过浏览把 dll加到引用. 添加命名空间: using Microsoft.WindowsMediaServices.Interop;
MSDN原版 也没见如何引用AvailableDiskSpace() 没定义AvailableDiskSpace()方法啊 public void readFiles() { // Sets the progress bar's minimum value to a number // representing the hard disk space before the files are read in. // You will most likely have to set this using a system call. // NOTE: The code below is meant to be an example and // will not compile. progressBar1.Minimum = AvailableDiskSpace(); // Sets the progress bar's maximum value to a number // representing the total hard disk space. // You will most likely have to set this using a system call. // NOTE: The code below is meant to be an example // and will not compile. progressBar1.Maximum = TotalDiskSpace(); // Uses a for loop to iterate through the operations to be // completed. In this case, five files are to be written // to the disk, so it will execute the loop 5 times. for (int i = 1; i<= 5; i++) { // Insert code to read a file into memory and update file size. // Increases the progress bar's value based on the size of // the file currently being written. progressBar1.Increment(FileSize); // Updates the label to show available drive space. label1.Text = "Current Disk Space Used = " + progressBar1.Value.ToString(); } }
using System.XX ?
TotalDiskSpace()因该怎么调用?
因该是有返回值的事件吧
搜索 microsoft.windowsmediaservices.dll
然后,添加引用时通过浏览把 dll加到引用.
添加命名空间:
using Microsoft.WindowsMediaServices.Interop;
没定义AvailableDiskSpace()方法啊 public void readFiles()
{
// Sets the progress bar's minimum value to a number
// representing the hard disk space before the files are read in.
// You will most likely have to set this using a system call.
// NOTE: The code below is meant to be an example and
// will not compile.
progressBar1.Minimum = AvailableDiskSpace();
// Sets the progress bar's maximum value to a number
// representing the total hard disk space.
// You will most likely have to set this using a system call.
// NOTE: The code below is meant to be an example
// and will not compile.
progressBar1.Maximum = TotalDiskSpace(); // Uses a for loop to iterate through the operations to be
// completed. In this case, five files are to be written
// to the disk, so it will execute the loop 5 times.
for (int i = 1; i<= 5; i++)
{
// Insert code to read a file into memory and update file size.
// Increases the progress bar's value based on the size of
// the file currently being written.
progressBar1.Increment(FileSize);
// Updates the label to show available drive space.
label1.Text = "Current Disk Space Used = " + progressBar1.Value.ToString();
}
}
搜过了 没有这个dll
或者看看有没有
"%windir%\system32\windows media\server\wmsservertypelib.dll"
把这个引用了试下。
TotalDiskSpace() ;
只是个例子,具体代码要自己写,英文注释里已经写的很明白了。