04-14-2016
02:01 AM
- Marcar como nuevo
- Favorito
- Suscribir
- Silenciar
- Suscribirse a un feed RSS
- Resaltar
- Imprimir
- Denunciar
04-14-2016
02:01 AM
Hi,
to give the focus to an application is a job Windows has to do, so you need to search for API function that makes the application pushed to the foreground.
Try that (lines to be changed compared to the previous code are green):
Option Compare Database
Private Declare Function BringWindowToTop Lib "user32" (ByVal hwnd As Long) As Long
Private Sub CMD_OPEN_Click()
On Error Resume Next
Dim tAcadApp As Object
Set tAcadApp = GetObject(, "AutoCAD.Application")
If (tAcadApp Is Nothing) Then
Set tAcadApp = CreateObject("AutoCAD.Application")
End If
If tAcadApp Is Nothing Then
Call MsgBox("AutoCAD not responding or not starting")
Else
tAcadApp.Visible = True
Call tAcadApp.Documents.Open(DrawingName)
Call BringWindowToTop(tAcadApp.hwnd)
End If
End Sub
HTH, - alfred -
------------------------------------------------------------------------------------
Alfred NESWADBA
ISH-Solutions GmbH / Ingenieur Studio HOLLAUS
www.ish-solutions.at ... blog.ish-solutions.at ... LinkedIn ... CDay 2025
------------------------------------------------------------------------------------

(not an Autodesk consultant)
Alfred NESWADBA
ISH-Solutions GmbH / Ingenieur Studio HOLLAUS
www.ish-solutions.at ... blog.ish-solutions.at ... LinkedIn ... CDay 2025
------------------------------------------------------------------------------------
(not an Autodesk consultant)