110,534
社区成员
发帖
与我相关
我的任务
分享
private void button1_Click(object sender, EventArgs e)
{
string name = "";
IWMMetadataEditor editor = null;
IWMHeaderInfo3 headInfo = null;
try
{
if (DialogResult.OK == openFileDialog1.ShowDialog())
{
name = openFileDialog1.FileName;
uint hr = WMFSDKFunctions.WMCreateEditor(out editor);
uint hhr = editor.Open(name);
headInfo = editor as IWMHeaderInfo3;
ushort cntMarkers = 0;
headInfo.GetMarkerCount(out cntMarkers);
headInfo.GetScriptCount(out cntMarkers);
//headInfo.AddMarker("course.Name", 10000000);
//headInfo.AddScript("URL", "course.Name", 10000000);
for (ushort i = 0; i < cntMarkers; i++)
{
string n = "";
ushort reqlen = 0;
ulong time=0;
string type = "";
string command = "";
ushort comLen = 0;
uint h = headInfo.GetMarker(i, null, ref reqlen, out time);
h = headInfo.GetMarker(i, n, ref reqlen, out time);
listView1.Items.Add(n);
//这里运行一次之后就会出现上述错误
//*
headInfo.GetScript(i, null, ref reqlen, null, ref comLen, out time);
headInfo.GetScript(i, type, ref reqlen, command, ref comLen, out time);
MessageBox.Show(type);
MessageBox.Show(command);
//*/
}
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
finally
{
//if (editor != null)
{
//editor.Flush();
//editor.Close();
}
}
}