userform on top VBA

Discussion in 'AutoCAD' started by johnsonm, Oct 1, 2004.

  1. johnsonm

    johnsonm Guest

    Does anyone know how to keep the userform on top and updated? I have written a batch routine that opens files then prints them. Everytime the print dialog pops up, it gets in front of the userform. Then I am left with a blank userform. Any suggestions would be helpful.

    Thanks in advance.
     
    johnsonm, Oct 1, 2004
    #1
  2. johnsonm

    VBA Guest

    Watch out for word-wrapping.

    Const HWND_TOPMOST = -1
    Const HWND_NOTOPMOST = -2
    Const SWP_NOSIZE = &H1
    Const SWP_NOMOVE = &H2
    Const SWP_NOACTIVATE = &H10
    Const SWP_SHOWWINDOW = &H40
    Private Declare Sub 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)

    Private Sub Form_Activate()
    'Set the window position to topmost
    SetWindowPos Me.hWnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOACTIVATE Or
    SWP_SHOWWINDOW Or SWP_NOMOVE Or SWP_NOSIZE
    End Sub


    written a batch routine that opens files then prints them. Everytime the
    print dialog pops up, it gets in front of the userform. Then I am left with
    a blank userform. Any suggestions would be helpful.
     
    VBA, Oct 1, 2004
    #2
  3. johnsonm

    AKS Guest

    YourUserform.Repaint seems to work for us. We also have a batch plotting routine that will run "hands free". The thing we want to do is suppress that plotting progress window. Our process can minimize AutoCAD when it is running if desired, but that damn plotting progress window pops up in front of whatever other application we may be doing for every plot in batch process. Is there a way to suppress that thing?
     
    AKS, Oct 1, 2004
    #3
  4. johnsonm

    johnsonm Guest

    Maybe I'm doing my userform wrong, if repaint works for me. How have you got yours setup?
     
    johnsonm, Oct 1, 2004
    #4
  5. johnsonm

    johnsonm Guest

    I get a "compile error: Method or Data Member not found" when I get to the line:

    SetWindowPos Me.hWnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOACTIVATE Or
    SWP_SHOWWINDOW Or SWP_NOMOVE Or SWP_NOSIZE

    Am I missing a reference?
     
    johnsonm, Oct 1, 2004
    #5
  6. johnsonm

    AKS Guest

    I am not sure what you are asking.
     
    AKS, Oct 4, 2004
    #6
  7. johnsonm

    user0 Guest

    have you looked into vbModeless and DoEvents?
     
    user0, Oct 4, 2004
    #7
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.