Author Topic: More than one Acad session currently running?  (Read 1812 times)

0 Members and 1 Guest are viewing this topic.

Amsterdammed

  • Swamp Rat
  • Posts: 507
  • Revit MEP 2016 Acad2013, OPEN DCL
More than one Acad session currently running?
« on: August 27, 2005, 07:59:27 AM »
Hello,

I wrote some accounting program for our company; making it easy for drafters to put in  on the end of the day what they were working on.

It starts a dialog with the BeginQuit event, reads log data out a text file, writes data with the user input added to excel sheets. In the end the txt file is deleted because the info is already stored.

Everything works fine, but there is one possible source of error: Having two Sessions of Autocad open at the same time and running the accounting dialog when closing the first session.

I know there is no reason for having two sessions running the same time, but we work with a HVAC application from a third party written in C++ and this software sometimes does strange moves.

Is there a simple way to find out if there is a second acadApp. Object running out there ?

Thanks in Advance,

Bernd
Bernd

MP

  • Seagull
  • Posts: 17530
More than one Acad session currently running?
« Reply #1 on: August 27, 2005, 08:29:54 AM »
Convert > this < code to VB; something like > this <.

:)
\|// Set goal. Experiment tirelessly until
|Oo| practice has become expertise.  Loop.
|- | LinkedIn | Dropbox

MP

  • Seagull
  • Posts: 17530
More than one Acad session currently running?
« Reply #2 on: August 27, 2005, 08:54:59 AM »
All you'd have to do is copy the code in Command1_Click Sub to a Public Function, called, let's see GetAcadAppCount and modify the logic in the do loop so that it tests the uProcess.szExeFile string for the inclusion of "acad.exe" (don't get tripped up by case or the additional info in the uProcess.szExeFile string) instead of pushing it to the listbox, talling and returning the number of instances found. I tried it and it worked fine under Windows XP, SP2; very easy stuff.

Might consider making it a generic function that takes one parameter, the name of the executable whose running instances you wish to tally.

I'd post my version but I'm honoring the author's wishes per his web site.

:)
\|// Set goal. Experiment tirelessly until
|Oo| practice has become expertise.  Loop.
|- | LinkedIn | Dropbox

Amsterdammed

  • Swamp Rat
  • Posts: 507
  • Revit MEP 2016 Acad2013, OPEN DCL
More than one Acad session currently running?
« Reply #3 on: August 27, 2005, 02:09:07 PM »
Thanks Mike

I was out in the yard working on my boat, so it took a while till i read your helpfull post.
Of course I didnít read it well enough in the first place (or not understood it) and got confused by the info attached to the string, but it works now.

I also will honour the authorís wish on his website.

 Bernd :D
Bernd

MP

  • Seagull
  • Posts: 17530
More than one Acad session currently running?
« Reply #4 on: August 27, 2005, 02:10:39 PM »
Good to hear it Bernd; thanks for checkin' back.
\|// Set goal. Experiment tirelessly until
|Oo| practice has become expertise.  Loop.
|- | LinkedIn | Dropbox