How to close text window

Discussion in 'AutoCAD' started by jjin, Jan 24, 2004.

  1. jjin

    jjin Guest

    Hi, Anyone knows how to close the text window.
    When I use sendcommand, Each time in the middle of program I have to manually to close the text window. Is there any way I can use VB code to close this window?
    thanks
    John
     
    jjin, Jan 24, 2004
    #1
  2. jjin

    allfro Guest

    allfro, Jan 25, 2004
    #2
  3. jjin

    developer Guest

    Using A2K in SDI mode I do it this way:

    ' declare needed Win32 API functions globally in a module
    Public Declare Function GetActiveWindow Lib "user32" () As Long

    Public Declare Function GetWindowText Lib "user32" _
        Alias "GetWindowTextA" (ByVal hwnd As Long, _
        ByVal lpString As String, ByVal cch As Long) As Long

    ' returns true if the AutoCAD text screen is currently active
    Public Function IsTextScr() As Boolean
        Dim Handle As Long
        Dim Title As String
        Title = Space(256)
        Handle = GetActiveWindow
        GetWindowText Handle, Title, 125
        If StrComp(Left(Title, 19), "AutoCAD Text Window", 1) = 0 Then
            IsTextScr = True
        End If
    End Function

    ' switch to the AutoCad drawing editor
    If IsTextScr Then
        SendKeys "{F2}", True
    End If
     
    developer, Jan 26, 2004
    #3
  4. jjin

    Kevin Terry Guest

    this works most of the time:

    ThisDrawing.SendCommand "graphscr" & vbCr

    Kevin

    manually to close the text window. Is there any way I can use VB code to
    close this window?
     
    Kevin Terry, Jan 29, 2004
    #4
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.