Kill SLDWorks.exe -Embedding

Hello

I developed an app in VB.NET. It works well, but the end of the execution is not completely clean.

  1. The application logs on to solidworks: swApp = New SldWorks
  2. There's a whole lot going on...
  3. Then I close the document:    swApp.CloseDoc(sDocfilename)
  4. There is still a lot going on and the program is coming to an end

Logically I have an empty solidworks window that remains open. If I close it by hand,  I see that the SLDWORKS process then goes into the list of "background processes" with a "-Embedding" in the command line. I notice the same phenomenon if I add in the code: swApp.ExitApp() .

This solidworks session in the background causes new sessions to crash. So you have to kill him by hand.

How to get out of it?

What is this -Embedding option?

Kind regards

Benedict

 

Hello

To get out of this you can, at the end of the program, make a loop that lists all the active processes and "kill" the "SLDWORKS.exe" process(es), which is what I do on all my programs (C#) that drive Solidworks at one time or another.

Kind regards

1 Like

I was wondering if there was a way for my application to list these child processes. But it doesn't look easy.

Killing all solidworks processes seems a bit brutal to me. My application is launched as a task (when a document is approved) and it would be a shame to kill the user's session.

To list the child processes, there is a functional solution written in C# ICI.

All you have to do is translate it into VB.Net and adapt to your needs.

Kind regards 

1 Like

I had already noticed it and it seemed complicated to me. I was hoping for something simpler and more straightforward in  system.diagnostic.process or something like that.

So I'll take the time to dig into this example.

Thank you and have a good evening

 

If it seems too complex for your needs and since it's a safe bet that you'll encounter problems related to the rights needed to use these functions, you may be able to get around it all by going back to the first suggestion (To get out of it you can, at the end of the program, make a loop that lists all the active processes and "kill" the "SLDWORKS.exe" process(es) but only kill the process whose "MainWindowTitle" contains a certain value, a value that you can define by creating for example a room with a "weird" name before killing this process. This allows you to stay on simple and direct access in system.diagnostic.process.

Kind regards

1 Like

Yes, indeed.

  1. Launch solidworks
  2. I open a document
  3. I identify the SolidWorks process
  4. there's a whole lot going on
  5. I kill this process

That doesn't seem bad to me

1 Like