Startapp and setting focus

Murph

Usenet Archive
Joined
Jul 21, 2003
Messages
120
Reaction score
0
I got a simple routine that starts up the expressviewer being called from a menu. It works other than the Viewer is not the active window, (sits in the taskbar) AutoCAD stays as the main window. Anyone know a way to set focus. Vlisp and using Active.app visible = True maybe?

(defun showSpec (unit / page )
(setq page (strcat "F://web_http//specbook//" unit ".dwf")) (startapp "ExpressViewer.exe" page)
)

Murph
 
Murph said:
I got a simple routine that starts up the expressviewer being called from a menu. It works other than the Viewer is not the active window, (sits in the taskbar) AutoCAD stays as the main window. Anyone know a way to set focus. Vlisp and using Active.app visible = True maybe?

(defun showSpec (unit / page )
(setq page (strcat "F://web_http//specbook//" unit ".dwf"))

)

How about:

(defun showSpec (unit)
(startapp "ExpressViewer.exe" (strcat "F://web_http//specbook//" unit ".dwf")) (vlax-put (vlax-get-acad-object) "WindowState" 2)
)
 
That works, of course AutoCAD is minimized now (when Expressviewer is closed) but they can live with that for right now.
Thanks

Murph

Murph said:
I got a simple routine that starts up the expressviewer being called from a menu. It works other than the Viewer is not the active window, (sits in the taskbar) AutoCAD stays as the main window. Anyone know a way to set focus. Vlisp and using Active.app visible = True maybe?

(defun showSpec (unit / page )
(setq page (strcat "F://web_http//specbook//" unit ".dwf"))

)

How about:

(defun showSpec (unit)
(startapp "ExpressViewer.exe" (strcat "F://web_http//specbook//" unit ".dwf")) (vlax-put (vlax-get-acad-object) "WindowState" 2)
)
 
That is the only simple way I could think of.
I suppose you could use VB or C++ to get the handle of the applicable windows, and change the Z order so that ExpressViewer on top, but AutoCAD stays just under it.
 
The simple way is fine for right now. If the idea of the parts catalog accessible from ACAD verses going to a 3" binder somewhere in a drawer or on a shelf somewhere works for my users and they use it then I'll pretty things up and spend the time to it in VB.

Murph

That is the only simple way I could think of.
I suppose you could use VB or C++ to get the handle of the applicable windows, and change the Z order so that ExpressViewer on top, but AutoCAD stays just under it.
 
Using VLisp:
(setq WshShell (vlax-create-object "WScript.Shell"))
(setq oExec (vlax-invoke-method WshShell 'Exec "C:\\Program Files\\Autodesk\\Autodesk Express Viewer\\ExpressViewer.exe C:\\TEST.DWF"))

Using VBA:
Public Sub test
Dim WshShell
Set WshShell = CreateObject("WScript.Shell")
WshShell.Run """C:\Program Files\Autodesk\Autodesk Express Viewer\ExpressViewer.exe"" "" C:\TEST.DWF""", 3 End Sub
 
This VBA equivalent does also work if the path to the exe file is using short names

(vlax-invoke-method wshshell 'Run
"C:/Progra~1/Autodesk/Autode~1/Expres~1.exe C:\\New Folder\\Test.DWF" 3 :vlax-false)
 
I like it :) Of course you are making hit the help files so I know what it is doing but it works great. Thanks Jimmy

Murph
 

Latest threads

Back
Top