Modal forms with Taskbar=1

Discussion in 'AutoCAD' started by Olaf, Aug 12, 2004.

  1. Olaf

    Olaf Guest

    Hi All,

    I have a problem with AutoCAD 2005 that my modal forms running from a VB6
    Dll project go behind the current AutoCAD drawing window when the new
    "TASKBAR" setting is set to 1.
    When "TASKBAR" is set to 0 then the form is modal to the current drawing.

    Earlier versions of AutoCAD do not have the problem as putting the open
    drawings on the taskbar is a new 2005 feature.

    Has anyone else had this problem and if so what is the solution?

    Thanks.

    Olaf
     
    Olaf, Aug 12, 2004
    #1
  2. Are you sure you don't mean MODELESS forms (the kind
    that can remain visible while the user issues commands
    in AutoCAD)?
     
    Tony Tanzillo, Aug 12, 2004
    #2
  3. Olaf

    Olaf Guest

    Hi Tony,

    No I do mean modal. My form has focus and AutoCAD cannot be accessed while
    my form is running but it disappears when more than 1 drawing is open with
    TASKBAR=1

    My forms are all called with form.show vbmodal

    If you press Alt-Esc very quickly you sometimes get it to come on top of the
    open drawing
    I have tried form.show vbsystemmodal but that is an invalid call.

    Olaf
     
    Olaf, Aug 12, 2004
    #3
  4. Its a hack but you could always force your form OnTop:

    Private Declare Function SetWindowPos Lib "user32" _
    (ByVal hWnd As Long, ByVal hWndInsertAfter As Long, _
    ByVal X As Long, ByVal Y As Long, ByVal cx As Long, _
    ByVal cy As Long, ByVal wFlags As Long) As Long
    Private Const SWP_NOMOVE = 2
    Private Const SWP_NOSIZE = 1
    Private Const FLAGS = SWP_NOMOVE Or SWP_NOSIZE
    Private Const HWND_TOPMOST = -1
    Private Const HWND_NOTOPMOST = -2

    Private Sub SetOnTop(hWnd As Long, OnTop As Boolean)
    Dim iReturn As Integer
    iReturn = IIf(OnTop = True, _
    SetWindowPos(hWnd, HWND_TOPMOST, 0, 0, 0, 0, FLAGS), _
    SetWindowPos(hWnd, HWND_NOTOPMOST, 0, 0, 0, 0, FLAGS))
    End Sub

    Then call SetOnTop when your form loads

    -- Mike
    ___________________________
    Mike Tuersley
    CADalyst's CAD Clinic
    Rand IMAGINiT Technologies
    ___________________________
    the trick is to realize that there is no spoon...
     
    Mike Tuersley, Aug 12, 2004
    #4
  5. Olaf

    Olaf Guest

    Hi Mike,

    I have already tried this and it does put it on top of all windows but when
    you drag the form around the screen it leaves copies of the form all over
    the screen.

    I think it is something Autodesk have not thought of when the taskbar option
    was introduced in 2005

    Olaf
     
    Olaf, Aug 12, 2004
    #5
  6. Hi Olaf,

    If you're getting screen smears, that's either a memory or graphics driver
    issue - or XP =) While there are definite issues with the taskbar, I
    wouldn't attribute it to this.

    -- Mike
    ___________________________
    Mike Tuersley
    CADalyst's CAD Clinic
    Rand IMAGINiT Technologies
    ___________________________
    the trick is to realize that there is no spoon...
     
    Mike Tuersley, Aug 12, 2004
    #6
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.