I've tried run task (if it matters, runs the file conversion on an another computer) in my PDM add-in. Inside function OnCmd I createTaskManager object, select task and call RunTask method.
EdmSelItem2[] selection = new EdmSelItem2[filteredfiles.Count];
List
int index = 0;
index = Information.LBound(ppoData);
int last = 0;
last = Information.UBound(ppoData);
//Append the paths of all files to a message string
while (index <= last)
{
filteredfiles .Add(((EdmCmdData)(ppoData.GetValue(index))));
index = index + 1;
}
for (int i = 0; i < filteredfiles.Count; ++i)
{
selection[i].mlID = filteredfiles[i].mlObjectID1;
selection[i].mlParentID = filteredfiles[i].mlObjectID3;
selection[i].mlVersion = 0;
selection[i].meType = EdmObjectType.EdmObject_File;
}
IEdmTaskMgr TaskMgr = (IEdmTaskMgr)((IEdmVault9)poVault).CreateUtility(EdmUtility.EdmUtil_TaskMgr);
System.Array Tasks = TaskMgr.GetTasks();
//Get task for generating files.
foreach (EdmTaskInfo task in Tasks)
{
if (task.mbsTaskName.Equals(CONVERTING_TASK_NAME))
{
TaskMgr.RunTask(task, selection, poCmd.mlParentWnd);
break;
}
}
Task starts corectly, but Windows Explorer always crashes with error code 0xc0000374. I've tried running in Dispather, another thread, System.Threading.Task, but result was always the same. What could be the causing the heap error?
SolidworksApi/macros