hexagon logo

VB code/ If a program is running

Does anyone know what code would be used to find out if a program is currently running in PC-Dmis? I wrote some code to automate the execution process and if I use it while a program is running, it closes the program and opens the new program while the original program continues to run. (Not sure for how long though. I stopped it after I tested it.)
  • How about making the setting form.visible=false on start, and vise-versa on end?
  • This was my "Fix"



    We don't use operator mode here, so I may be worrying about nothing - but I strongly suggest that you test on-line to see if you're getting those dialog boxes.


  • I'll keep that in mind. Once I get the rest of this figured out, I will do this other testing to see where the downfalls are. Thanks for letting me know about these.
  • I thought about both of these ideas, but I trying to make it to where only when a program is running it will do this. Mainly because if someone opens a wrong program, then the buttons are disabled. I would have to create an easy failsafe but then they would be able to unlock the buttons during a run if they knew about it. I have a 4th button that when admin enters a password, it would unlock the buttons manually. Also, we do a lot of sorts or multiple runs, the buttons would only be locked on the first run if I refreshed after the first run. I think I found the issue and I'm trying to work around it. *see latest post
  • So I figured out where the issue lies. If I open PC-Dmis through the script and do all of my code, everything works as intended. All code runs inside of the events and no server busy error happens. The problem is, since I want try operator mode to open, I am opening PC-Dmis through the .exe

    Process.Start("C:\Program Files\Hexagon\PC-DMIS 2017 R2 64-bit\PCDLRN.exe", "/o")


    This gives me the correct operator mode. Since I basically open PC-Dmis with the script at the beginning with this

    Dim oPcd As Application = New Application()


    Opening the operator mode over top of it works until I get to the events. This is when things mess up. If I quit the app and kill it in task manager after

    Dim oPcd As Application = New Application()


    Then open

    Process.Start("C:\Program Files\Hexagon\PC-DMIS 2017 R2 64-bit\PCDLRN.exe", "/o")


    after a few seconds, everything works like it should. This seems like a PITA and I'm sure there is a better way. At least I pinpointed my problem though
  • Wish I could be there to tackle this for you... sounds FUN!!!
  • You had your chance dude. Lol.

    I don't like complicating things like this. Is indeed fun.i enjoy like making it work. Been doing this a long time and have come to realize that simple is better. Force into it though. Only responding to the onopen event. To make a little edit to the programs before they run. Ill be adding cmm error logs when I have time, and that'll be it. Maybe. Wink