Results 1 to 4 of 4

Thread: Handler AutoCAD Window Moved

  1. #1
    100 Club
    Join Date
    2002-10
    Posts
    154
    Login to Give a bone
    0

    Default Handler AutoCAD Window Moved

    Is there a way to handle the event when the AutoCAD application moved?

    something like this..
    AddHandler Application.LocationChanged, AddressOf Window_LocationChanged

    If so, where do I find it. And if this can be done, I need to get the position of the window too.

    Something like this..
    Private Sub MainWindow_LocationChanged(ByVal sender As Object, _
    ByVal e As System.EventArgs)
    Dim mTop as double = sender.Top
    Dim mLeft as double = sender.Left
    End Sub

  2. #2
    100 Club
    Join Date
    2002-10
    Posts
    154
    Login to Give a bone
    0

    Default Re: Handler AutoCAD Window Moved

    It appears that I should do something like this…

    1. Dim acApp As AcadApplication
    2. acApp = Autodesk.AutoCAD.ApplicationServices.Application.AcadApplication
    3. AddHandler acApp.WindowMovedOrResized, AddressOf ACADApp_WindowMovedOrResized

    But on Line 2, I get this error…
    Unable to cast COM object of type 'System.__ComObject' to interface type 'Autodesk.AutoCAD.Interop.AcadApplication'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{2959C1CC-8577-4EDB-ADDC-6EBBAB147926}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).

    I have also tried this too but I did not have any luck.
    acApp = DirectCast(Marshal.GetActiveObject("AutoCAD.Application"), AcadApplication)

    I read some documents about this being a bug in AutoCAD and some people were accessing the application like this…
    acApp.GetType().InvokeMember("COPY", System.Reflection.BindingFlags.InvokeMethod, Nothing, acApp, Nothing)
    but I have not gotten it work either.

  3. #3
    Member
    Join Date
    2015-11
    Posts
    38
    Login to Give a bone
    0

    Default Re: Handler AutoCAD Window Moved

    See this I've Just posted.
    http://forums.augi.com/showthread.php?t=134795
    Im not sure it will help with you problem but I would be interested If you had found a fix...

  4. #4
    Administrator Ed Jobe's Avatar
    Join Date
    2000-11
    Location
    Turlock, CA
    Posts
    6,396
    Login to Give a bone
    0

    Default Re: Handler AutoCAD Window Moved

    Do you have the Autodesk.AutoCAD.Interop dll listed in your References?
    C:> ED WORKING....

Similar Threads

  1. AutoCAD Handler Overwrites
    By tom6864 in forum Dot Net API
    Replies: 5
    Last Post: 2013-04-06, 05:20 PM
  2. How is autocad finding ole files that have been moved?
    By framedNlv in forum CAD Management - General
    Replies: 2
    Last Post: 2010-01-25, 04:09 PM
  3. Window Style mod w/ Frame moved
    By fletch97 in forum ACA General
    Replies: 5
    Last Post: 2009-01-30, 11:50 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •