Hello,
So I have a macro that deletes an old block from a drawing and replaces it in the same location with a new block. On some drawings it works fine and on other ones I get this popup twice whenever it is run.
Does anyone know of a way to have the macro close them if/when they pop up?
I am using C#.
Thanks,
How to close popups
-
- Posts: 26
- Joined: Wed Jul 21, 2021 3:20 pm
- x 6
- x 2
Re: How to close popups
You'll have to use WinAPI to enumerate all windows and detect the one you are interested in. Then use WinAPI again to send IDOK for the dialog. Note that all controls, labels, buttons and everything in every dialog/form IS a window, so you need to consider also performance when implementing something like that.
Look for WinAPI and P/Invoke. You'll probably need to use functions like GetClassName, GetDesktopWindow, SendMessage, FindWindow, GetWindowText, GetWindow, IsWindowVisible. You might also need to use a tool called Spy++ to get some window information about that particular messagebox so that you can easier detect it via API.
Look for WinAPI and P/Invoke. You'll probably need to use functions like GetClassName, GetDesktopWindow, SendMessage, FindWindow, GetWindowText, GetWindow, IsWindowVisible. You might also need to use a tool called Spy++ to get some window information about that particular messagebox so that you can easier detect it via API.
Product Manager, CUSTOMTOOLS for SOLIDWORKS
Over decade of experience around SW, PDM, and related ERP integrations.
Tech-oriented; once a programmer, always a programmer.
https://www.customtools.info/
https://www.youtube.com/user/CustomTools4SW/
Over decade of experience around SW, PDM, and related ERP integrations.
Tech-oriented; once a programmer, always a programmer.
https://www.customtools.info/
https://www.youtube.com/user/CustomTools4SW/
Re: How to close popups
You might have better luck figuring out what condition of the document is causing the message and preventing it by removing the condition.