Hello all,
I have a problem with the ".LockFile" Method because the file is open in SolidWorks. The error code is 0x8004020B.
In my code, I want to display a messagebox that does not disappear until the drawing has been closed by the user. How can I do this?
Here is my code:
......
string newComment = serialNbrValueValue + " | " + CommentVal;
IEdmEnumeratorVariable5 varEnum3 = default(IEdmEnumeratorVariable5);
DialogResult dialogResult = MessageBox.Show("Die Datei " + File.Name + " ist geöffnet und muss unbedingt geschlossen werden!", "Datei " + File.Name + " schließen", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1);
if (dialogResult == DialogResult.OK)
{
try
{
File.LockFile(ppoRetParentFolder.ID, 0, (int)EdmLockFlag.EdmLock_Simple);
}
catch (COMException exp)
{
string errorName, errorDesc;
vault.GetErrorString(exp.ErrorCode, out errorName, out errorDesc);
vault.MsgBox(0, errorDesc, EdmMBoxType.EdmMbt_OKOnly, errorName);
}
...
Any help would be appreciated.
Thanks, Mario
SolidworksApi macros