Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Make an Application "On Top"

Status
Not open for further replies.

DougP

MIS
Dec 13, 1999
5,985
US
&nbsp;&nbsp;&nbsp;&nbsp;Dim Drawing1 As String, AcadObj As Object<br>&nbsp;&nbsp;&nbsp;&nbsp;Drawing1 = Me![Drawings to Print subform].Form![Path] & Me![Drawings to Print subform].Form![Part Number]<br>&nbsp;&nbsp;&nbsp;&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;Set AcadObj = GetObject(, &quot;AutoCAD.Application&quot;)<br>&nbsp;&nbsp;&nbsp;&nbsp;AcadObj.ActiveDocument.Open Drawing1<br><br>I am using the above code to find AutoCAD which is already running.<br>Then I am opening a drawing (last line)<br><br>Is there way to then make AutoCAD pop up and be on top?<br>&nbsp;&nbsp;&nbsp;&nbsp;<br> <p>DougP<br><a href=mailto: dposton@universal1.com> dposton@universal1.com</a><br><a href= > </a><br> Ask me how Bar-codes can help you be more productive.
 
Without trying your code (don't have Acad on this system) I just wonder if it wouldn't be easiest to minimize your application after Acad loads the drawing and then restore the app window when the drawing name changes in the active Acad window title.<br><br>Other than that, you could try pointing the Acad.lsp to a VBA script that uses the SetWindowPos() API in the ThisDrawing.Activate event (no sense in trying if you don't have Acad2000, don't know if it would work if you did, seems like using a sledge hammer to kill a cockroach, grumble grumble....)<br><br>Without a clear answer to your question, I hope my rambling has inspired you to find the solution and post back with it so I'll be able to use it, too. &lt;g&gt;<br><br>I'll play around with it when I sit down at my CAD machine tomorrow and let you know if come up with something better than &quot;minimizing the app&quot;.<br><br><br> <p> <br><a href=mailto: > </a><br><a href= plain black box</a><br>
 
I do a similar thing with SolidWorks:<br><br>Dim swApp As Object<br>Dim hwnd As Long<br><br><br>Declare Function FindWindow Lib &quot;user32&quot; Alias &quot;FindWindowA&quot; (ByVal lpClassName As String, ByVal lpWindowName As String) As Long<br><br>Declare Function ShowWindow Lib &quot;user32&quot; (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long<br><br><br>Set swApp = CreateObject(&quot;SldWorks.Application&quot;)<br>swApp.Visible = True<br>swApp.UserControl = False&nbsp;&nbsp;&nbsp;'Take control from the user<br>&nbsp;&nbsp;&nbsp;&nbsp;<br>'maximize window - need window name<br>hwnd = FindWindow(vbNullString, &quot;SolidWorks 2000&quot;)<br>If hwnd &lt;&gt; 0 Then Call ShowWindow(hwnd, vbMaximizedFocus)<br><br>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top