I am running some background automation on AutoCAD (2012 if it matters) and I am running into an annoying issue where even when AutoCAD's visibility is set to false and it's window state is minimized it still grabs focus when a drawing opens.
Me.autoCadApplication.WindowState = AcWindowState.acMin Me.autoCadApplication.Visible = False
Does anyone know how to fix this? It makes my computer unusable when the automation runs.
I don't think there is alot you can do via AutoCAD to control that. I think it's more of a Windows setup issue.
I vaguely remember that there was a setting which allowed you to control how the focus reacted for programs starting up in Windows but I can't find it now. I'm sure some dedicated internet searching will dig this information up.
I think you're referring to the desktop registry setting which disables applications from stealing active window focus. This is already set to not allow applications to do that.
I'm quite sure this is an AutoCAD issue, no other program that I've automated shares this behaviour (Excel, Word, Visio, etc...). It's unforunate that there doesn't seem to be a way to stop it.
FYI - I'm looking into this for you... I need to make sure that I'm on the same page as you before moving forward with this - do you have a build able sample project that I can refer to please?
Thank you for looking into this.
I could upload a sample if you need, but all I am really doing is:
While an application with the above structure runs, AutoCAD will steal focus everytime the next document is opened. So if you were typing in a window you would get about 1-2 seconds of time in that window before AutoCAD would steal focus back and you would be forced to refocus the window you were just on.
Without a sample, I cannot proceed... if you do not want to post a sample, then you will have to control the focus with your own Win32 application code to bypass the issues.
Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register
Start with some of our most frequented solutions to get help installing your software.