Window position used by WindowState:=acNorm

Discussion in 'AutoCAD' started by Jack Houben, Sep 2, 2004.

  1. Jack Houben

    Jack Houben Guest

    Hello all,

    Does anyone know where the AutoCad Window position is stored?

    I want to manipulate the position to wich the AutoCad Window is resored when calling AcadApp.WindowState:=acNorm.

    Note: AutoCad is minimized.

    Tnks,

    Jack
     
    Jack Houben, Sep 2, 2004
    #1
  2. Jack Houben

    jdinardi Guest

    It's stored in the registry, I believe under the fixed profile key (verify this). You might want to change it manually for testing purposes before going through the work of writing code to do it.

    Always back up your registry before hacking around in there as a precaution.


    Regards,
    Jacob Dinardi
     
    jdinardi, Sep 2, 2004
    #2
  3. Jack Houben

    Jack Houben Guest

    Hello Jacob,

    I don't mean the position AutoCAD will appear next time you start it. But the position AutoCAD will apear when it is called from minimized position on the taskbar.

    Jack
     
    Jack Houben, Sep 3, 2004
    #3
  4. Jack Houben

    Danny P. Guest

    ThisDrawing.Application.WindowTop and
    ThisDrawing.Application.WindowLeft

    Am I missing something here?

    Hope that helps,
    Danny Polkinhorn
    WATG
    Honolulu
     
    Danny P., Sep 3, 2004
    #4
  5. Jack Houben

    jdinardi Guest

    I guess I missed it too :) I thought we were taking about finding the last position it was running at, should have read more closely. I don't see why you would care in that case. When the window is restored it will go back to the position in was last in.

    If you want it to go someplace else and/or resize just set the window properties as Danny mentioned above ^


    Jacob
     
    jdinardi, Sep 3, 2004
    #5
  6. Jack Houben

    Jack Houben Guest

    Yes Danny,

    You missed my Note!
    Note: AutoCad is minimized

    Then you get the error: Cannot set properties while minimized

    ??
     
    Jack Houben, Sep 6, 2004
    #6
  7. Jack Houben

    Jack Houben Guest

    Yes Danny,

    You missed my Note!
    Note: AutoCad is minimized

    Then you get the error: Cannot set properties while minimized

    ??

    Sorry Jacob I posted it as reply to you
     
    Jack Houben, Sep 6, 2004
    #7
  8. Jack Houben

    jdinardi Guest

    Jack,

    You just need to hook into the application object's events. To do so (I'm assuming you don't know this yet) you either need to create a class module, or you can use the ThisDrawing module. I prefer to do this in my .dvb file that runs at startup so I know I can always hook events.

    In you calss module general declaration section (the very top) add the following lines:

    Private WithEvents oAcadApp As AcadApplication

    Private Sub Class_Initialize()
    Set oAcadApp = ActiveDocument.Application
    End Sub

    Private Sub Class_Terminate()
    Set oAcadApp = Nothing
    End Sub

    ...now you can actually click in object drop down (in the upper left corner of your code window) and select oAcadApp (or whatever you called the variable) just like it was any other object in a form for example. In the events drop down (upper right corner) you can see all the events. In the example below I used the WindowChanged event to set the window position when the window is restored to its normal state.


    Private Sub oAcadApp_WindowChanged(ByVal WindowState As AcWindowState)
    If WindowState = acNorm Then
    oAcadApp.WindowLeft = 0
    oAcadApp.WindowTop = 0
    End If
    End Sub


    ... Did that clear it up?

    Jacob.
     
    jdinardi, Sep 7, 2004
    #8
  9. Jack Houben

    jdinardi Guest

    I negelected to mention that you also need to do the following, say in your startup macro:

    Dim yourVariable as nameOfCLassFromAbove
    Set yourVariable = New nameOfClassAbove


    When you want to stop receiving events (if you do):

    Set yourVariable = Nothing


    Let us know how it works out.
     
    jdinardi, Sep 7, 2004
    #9
  10. Jack Houben

    Jack Houben Guest

    Thanks Jacob,

    I'll dig into it, and try to find out how these events work


    Jack
     
    Jack Houben, Sep 8, 2004
    #10
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.