How to close text window

  • Thread starter Thread starter jjin
  • Start date Start date
J

jjin

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
 
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
 
this works most of the time:

ThisDrawing.SendCommand "graphscr" & vbCr

Kevin

jjin said:
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?
 
Back
Top