Team,
i found a way where i can able to get the list of process related to inventor documents. from list the list, i can able to select the document and manipulate that document how i need..
private void LoadInventorProcesses()
{
processListBox.ItemsSource = null;
IRunningObjectTable rot;
IEnumMoniker enumMoniker;
IMoniker[] monikers = new IMoniker[1];
GetRunningObjectTable(0, out rot);
rot.EnumRunning(out enumMoniker);
enumMoniker.Reset();
IntPtr fetched = IntPtr.Zero;
while (enumMoniker.Next(1, monikers, fetched) == 0)
{
IBindCtx bindCtx;
CreateBindCtx(0, out bindCtx);
string displayName;
monikers[0].GetDisplayName(bindCtx, null, out displayName);
Console.WriteLine(displayName);
if (displayName.Contains(".iam") || displayName.Contains(".ipt") || displayName.Contains(".idw"))
{
processListBox.Items.Add(displayName);
}
}
}
private void ProcessListBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
var selectedProcess = (dynamic)processListBox.SelectedItem;
processListBox.ItemsSource = null;
IRunningObjectTable rot;
IEnumMoniker enumMoniker;
IMoniker[] monikers = new IMoniker[1];
GetRunningObjectTable(0, out rot);
rot.EnumRunning(out enumMoniker);
enumMoniker.Reset();
IntPtr fetched = IntPtr.Zero;
while (enumMoniker.Next(1, monikers, fetched) == 0)
{
IBindCtx bindCtx;
CreateBindCtx(0, out bindCtx);
string displayName;
monikers[0].GetDisplayName(bindCtx, null, out displayName);
if (displayName == (dynamic)processListBox.SelectedItem )
{
object comObject;
rot.GetObject(monikers[0], out comObject);
Document oAsm = (Document)comObject;
oAsm.Save2(true);
MessageBox.Show(oAsm.DisplayName);
}
}
}