Author Topic: Get EA main window handle or PID of running EA  (Read 2865 times)

xMarkos

  • EA Novice
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
Get EA main window handle or PID of running EA
« on: April 30, 2011, 10:24:29 pm »
Hello,

For specific reasons I need to get window handle to main EA window, that shows up after using Repository.ShowWindow() function.

I could do this by calling FindWindow() or GetForegroundWindow() from WinAPI, but this would cause problems if more instances were running (or windows with similar titles).

I wanted to know if there is some built-in way to retrieve the window handle (or at least process ID) of the current EA process started by Automation Interfaces.

If there is not a way to do this, I would like to hear suggestions of possible workarounds.

I am looking forward for your replies,

Markos

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13241
  • Karma: +554/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Get EA main window handle or PID of running EA
« Reply #1 on: May 03, 2011, 04:53:44 pm »
Markos,

I don't know if the window handle is available from the API, but if you explain your requirements we might be able to give you an alternative.

Geert

xMarkos

  • EA Novice
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
Re: Get EA main window handle or PID of running EA
« Reply #2 on: May 04, 2011, 01:36:33 pm »
I've been asked to program tool that allows it's user to automatize "Import DB Schema from ODBC". Since Automation Interfaces do not offer this functionality, I decided to accomplish this using "input simulation" (simulation of clicks and keyboard in controls).

I have been successful so far, but the problem is to find the correct window to work with, in case of multiple EA instances running.

(I have sent feature request already, but I need to have this working ASAP)

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13241
  • Karma: +554/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Get EA main window handle or PID of running EA
« Reply #3 on: May 04, 2011, 04:39:35 pm »
Markos,

I guess you know about the possibility to get the Repository object for a running instance of EA?
I've noticed that in case of multiple running instances it returns the instance that was first started up.

Geert