Get ActiveDrawing by hWnd

When swapping between opened drawings in a Bricscad session, there is a WindowMovedOrResized event which can be trapped. It passes the hWnd of the frame being resized (and a bool bMoved flag). How do I associate this handle with the name of the drawing being resized?TIA,Arno van Eeuwen

Comments

  • Can you get the name of the active document as the event fires?I.e

    namespace Test{ using System; using BricscadApp; using RxNet.ApplicationServices; public class reactor { bool _active; AcadApplication _app; public reactor() { _active = false; _app = Application.AcadApplication as AcadApplication; if (_app == null){ throw new Exception("Could Not Get Application"); } } public void run(){ if (!_active) { _app.ActiveDocument.WindowMovedOrResized += new _DAcadDocumentEvents_WindowMovedOrResizedEventHandler(callback_event); _active = true; } } public void stop() { if (_active) { _app.ActiveDocument.WindowMovedOrResized -= new _DAcadDocumentEvents_WindowMovedOrResizedEventHandler(callback_event); _active = false; } } private void callback_event(int hwnd, bool flag){ _app.ActiveDocument.Utility.Prompt (string.Format("\n{0}, {1}, {2}, {3}", //get the info we need flag, hwnd, _app.HWND, _app.ActiveDocument.Name)); } }}
  • Hi Daniel,the WindowMovedOrResized event fires twice upon swapping drawings. One is triggered by the drawing 'loosing the focus' and the other one by the newly activated drawing as it seems to me. What I really would like to have is a DocumentActivate event but that is not available. (yet?)So now I have to find out which of the two is the ActiveDrawing...I was hoping to find some way to get my hands on the Document object by using it's handle.Any ideas?Arno

  • Right, it seems that some of these features are not implemented yet, one of which is getting the HWND of the active document, I do believe that these do function correctly in BRXDan

This discussion has been closed.