.NET
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
AutoCAD Steals Focus While Visible Is False and WindowStat e Is Minimized?
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
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.
Re: AutoCAD Steals Focus While Visible Is False and WindowStat e Is Minimized?
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
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.
Fenton Webb
Developer Technical Services
Autodesk Developer Network
Re: AutoCAD Steals Focus While Visible Is False and WindowStat e Is Minimized?
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
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.
Re: AutoCAD Steals Focus While Visible Is False and WindowStat e Is Minimized?
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
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?
Fenton Webb
Developer Technical Services
Autodesk Developer Network
Re: AutoCAD Steals Focus While Visible Is False and WindowStat e Is Minimized?
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Thank you for looking into this.
I could upload a sample if you need, but all I am really doing is:
- Gettting an instance of AutoCAD (2012).
- Setting Visible to False and setting WindowState to acMin on the Application object (like first post).
- Looping through a data set with push information.
- Opening a series of templates 1-by-1 and pushing the associated information onto the template and then "Save As-ing" it to a file and continuing.
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.
Re: AutoCAD Steals Focus While Visible Is False and WindowStat e Is Minimized?
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Have you tried it without setting the window state to minimized?
Re: AutoCAD Steals Focus While Visible Is False and WindowStat e Is Minimized?
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
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.
Fenton Webb
Developer Technical Services
Autodesk Developer Network
