Focus stealing

Creator
Creator

Hi

I making some Solid Edge automation process. In this process i have to open/close and many more operatoins on documents.

The automation process is working in background.

The problem is that Solid Edge is stealing focus during the operations.

I can set TopMost to my application, but this is not a solution.

During the automation process i can`t use other programs. Internet explorer, windows explorer, MS Office and many more.

The system just "hangs" for a few seconds, i see the "wait mouse" for a second, and the focus is stollen no matter what program i use.

SolidEdge_Application.Visible = false also not make a difference.

I am using i7 comuter. 8 cores. so i see that Solid edge is using only one core. just a 1/8 of processor time is busy, but the automation process (takes about 15 minutes) makes imposible to use all other programs.

 

Using VS 2013, C#, Solid Edge ST5 (same problem in other versions)

Windows 7 x64 proffesional

3 REPLIES

Re: Focus stealing

Solution Partner Phenom Solution Partner Phenom
Solution Partner Phenom

There are several Application properties you could test, but setting Visible and Interactive to False should be enough.

Don't forget to reset these properties, when you're done with your batch processing.

Re: Focus stealing

Solution Partner Phenom Solution Partner Phenom
Solution Partner Phenom

This code works for me without stealing focus.

 

Visual Studio 2012

C#

Solid Edge ST6 x64

Windows 8.1 x64

 

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Runtime.InteropServices;

namespace ConsoleApplication1
{
    class Program
    {
        [STAThread]
        static void Main(string[] args)
        {
            SolidEdgeFramework.Application application = (SolidEdgeFramework.Application)Activator.CreateInstance(Type.GetTypeFromProgID("SolidEdge.Application"));

            application.DisplayAlerts = false;
            application.Visible = true;
            SolidEdgeFramework.Documents documents = application.Documents;
            
            DirectoryInfo folder = new DirectoryInfo(@"C:\Program Files\Solid Edge ST6\Training");

            foreach (FileInfo fileInfo in folder.GetFiles("*.par", SearchOption.TopDirectoryOnly))
            {
                Console.WriteLine("Opening '{0}'", fileInfo.FullName);

                SolidEdgeFramework.SolidEdgeDocument document = (SolidEdgeFramework.SolidEdgeDocument)documents.Open(fileInfo.FullName);
                application.DoIdle();
                System.Threading.Thread.Sleep(200);
                document.Close();

                application.DoIdle();
                System.Threading.Thread.Sleep(200);
            }

            application.Quit();
        }
    }
}

 

Jason Newell
Applications Architect
www.jasonnewell.net

Re: Focus stealing

Creator
Creator

Hi
Thank You very much!
i've been searching the solution a long time.
The realy solution was in applying Solid_Edge_Application.Interactive = false AND Visible=false
Only interactive to false still freeze a little, i think because of the redrawing screens.
When Solid Edge is interactive=false and visible=false, the system just keep working fast, as if no process run at all.