I'm using Windows 7 64-bit Ultimate edition
Here is my program code for C#:
using System;
using System.Collections;
using System.Windows.Forms;
using Sony.Vegas;
using System.Drawing;
namespace Example
{
public class Example : ICustomCommandModule
{
protected Vegas myVegas = null;//Dockable edition
public void InitializeModule(Vegas vegas)
{
myVegas = vegas; //Dockable edition
}
CustomCommand myViewCommand = new CustomCommand(CommandCategory.View, "myViewCommand");
public ICollection GetCustomCommands()
{
myViewCommand.DisplayName = "Hello World View";
myViewCommand.Invoked += this.HandleInvoked;
myViewCommand.MenuPopup += this.HandleMenuPopup;
return new CustomCommand[] { myViewCommand };//Dockable edition
}
void HandleInvoked(Object sender, EventArgs args)
{
if (!myVegas.ActivateDockView("YTPMView"))
{
DockableControl dockView = new DockableControl("YTPMView");
Button mbutton = new Button();
mbutton.Size = new Size(120, 40);
mbutton.Location = new Point(30, 30);
mbutton.Text = "This button";
mbutton.Click += new EventHandler(mbutton_Click);
dockView.Controls.Add(mbutton);
myVegas.LoadDockView(dockView);
}
}
private void mbutton_Click(object sender, EventArgs e)
{
Project activeProject = myVegas.Project;
try
{
activeProject.Tracks[0].Events[0].Start = startl;
}
catch(System.Runtime.InteropServices.COMException ex)
{
MessageBox.Show(ex.Message);
}
catch (Exception ex)
{
MessageBox.Show(ex.GetType().ToString());
}
}
void HandleMenuPopup(Object sender, EventArgs args)
{
myViewCommand.Checked = myVegas.FindDockView("YTPMView");
}
}
}
Specifically the problem is when I try this:
activeProject.Tracks[0].Events[0].Start = startl;
It gives back an error that gives the message "Catastrophic failure (Exception from HRESULT: 0x8000FFFF (E_UNEXPECTED))"
This only happens when I try to CHANGE things in the project (even using methods such as 'Copy()'); but when I just load data about the project (e.g., I get the start, length, and end times), it works normally.
What is going wrong? Am I doing something wrong?