Startapp and setting focus

Discussion in 'AutoCAD' started by Murph, Dec 23, 2003.

  1. Murph

    Murph Guest

    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, Dec 23, 2003
    #1
  2. Murph

    R.K. McSwain Guest

    How about:

    (defun showSpec (unit)
    (startapp "ExpressViewer.exe" (strcat "F://web_http//specbook//" unit ".dwf"))
    (vlax-put (vlax-get-acad-object) "WindowState" 2)
    )
     
    R.K. McSwain, Dec 23, 2003
    #2
  3. Murph

    Murph Guest

    That works, of course AutoCAD is minimized now (when Expressviewer is
    closed) but they can live with that for right now.
    Thanks

    Murph


    How about:

    (defun showSpec (unit)
    (startapp "ExpressViewer.exe" (strcat "F://web_http//specbook//" unit
    ".dwf"))
    (vlax-put (vlax-get-acad-object) "WindowState" 2)
    )
     
    Murph, Dec 23, 2003
    #3
  4. Murph

    R.K. McSwain Guest

    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.
     
    R.K. McSwain, Dec 23, 2003
    #4
  5. Murph

    James Murphy Guest

    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.
     
    James Murphy, Dec 24, 2003
    #5
  6. 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

    --
    Best Regards, Jimmy Bergmark
    CAD and Database Developer Manager at www.pharmadule-emtunga.com
    Take a look at the trial version of SmartPurger or
    download some freeware at www.jtbworld.com
    More on AutoCAD 2004;
    www.jtbworld.com/autocad2004.htm
    www.jtbworld.com/autocad2004tips.htm
     
    Jimmy Bergmark, Dec 25, 2003
    #6
  7. Jimmy Bergmark, Dec 25, 2003
    #7
  8. Murph

    Murph Guest

    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
     
    Murph, Dec 26, 2003
    #8
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.