Splash Screen

Discussion in 'AutoCAD' started by Martin Wright, Jun 10, 2004.

  1. I would like to dispaly a splash screen when one of my functions is running
    I propose touse a userform but would like to remove the title bar form the
    form.
    I especially would like to remove the form close cross in the top right
    corner.
    How can I do this?
    Thanks
    Martin Wright
     
    Martin Wright, Jun 10, 2004
    #1
  2. I have the following code in a module called TitleBar.
    Code:
    Option Explicit
    Private Declare Function GetActiveWindow Lib "user32.dll" () As Long
    Private Declare Function GetSystemMenu Lib "user32.dll" (ByVal hwnd As Long, ByVal bRevert As Long) As Long
    Private Declare Function RemoveMenu Lib "user32.dll" (ByVal hMenu As Long, ByVal uPosition As Long, ByVal uFlags As Long) As Long
    Private Declare Function DrawMenuBar Lib "user32.dll" (ByVal hwnd As Long) As Long
    Private Declare Function GetWindowLong Lib "user32.dll" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long
    Private Declare Function SetWindowLong Lib "user32.dll" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
    
    Public Sub DisableClose()
    Dim hwnd As Long
    Dim hMenu As Long
    hwnd = GetActiveWindow()
    hMenu = GetSystemMenu(hwnd, 0)
    Call RemoveMenu(hMenu, 6, &H400)
    Call RemoveMenu(hMenu, 5, &H400)
    Call DrawMenuBar(hwnd)
    End Sub
    
    Public Sub Remove()
    Dim hwnd As Long
    Dim dwNewLong As Long
    hwnd = GetActiveWindow()
    dwNewLong = GetWindowLong(hwnd, -16)
    dwNewLong = dwNewLong And Not &HC00000
    Call SetWindowLong(hwnd, -16, dwNewLong)
    DrawMenuBar hwnd
    End Sub
    
    This is an example using it to remove a titlebar:
    Private Sub UserForm_Activate()
    Call TitleBar.Remove
    End Sub

    Regards - Nathan
     
    Nathan Taylor, Jun 10, 2004
    #2
  3. Also how do I show the form so that the calling code continues to run.
     
    Martin Wright, Jun 10, 2004
    #3
  4. Martin,

    Not sure if this will help or not. I am not a VBA or VB user (LISP mainly),
    but I got this piece of code when trying to create a splash screen for a
    setup program. Create a form add a timer object then this is the code for
    the timer:

    Private Sub Timer1_Timer()
    Unload Me
    End Sub

    Set the timer properties accordingly

    This is from VB not sure if it will work in VBA or not.

    --
    _________________________________
    Timothy Spangler

    "You cannot escape the responsibility of tomorrow by evading it today"
    Abraham Lincoln
    _________________________________

    AutoCAD 2002
    WinXP
    Compaq Evo W6000
    Intel Xeon / 1G RAM
     
    Timothy Spangler, Jun 10, 2004
    #4
  5. Martin Wright

    Matt W Guest

    VBA doesn't have a timer control like VB, but I know there are some
    "home-grown" timers out there that will work with VBA.

    I think Randall Rath had one a while back, or was it Ralph the Wonder
    Llama??! I'm not sure if his site is still around. I think it was
    www.vbdesign.net ?? There was a downloads section.



    --
    Matt W

    There are 3 kinds of people:
    Those who can count, and those who can't.

    | Martin,
    |
    | Not sure if this will help or not. I am not a VBA or VB user (LISP
    mainly),
    | but I got this piece of code when trying to create a splash screen for a
    | setup program. Create a form add a timer object then this is the code for
    | the timer:
    |
    | Private Sub Timer1_Timer()
    | Unload Me
    | End Sub
    |
    | Set the timer properties accordingly
    |
    | This is from VB not sure if it will work in VBA or not.
    |
    | --
    | _________________________________
    | Timothy Spangler
    |
    | "You cannot escape the responsibility of tomorrow by evading it today"
    | Abraham Lincoln
    | _________________________________
    |
    | AutoCAD 2002
    | WinXP
    | Compaq Evo W6000
    | Intel Xeon / 1G RAM
    | | > I would like to dispaly a splash screen when one of my functions is
    | running
    | > I propose touse a userform but would like to remove the title bar form
    the
    | > form.
    | > I especially would like to remove the form close cross in the top right
    | > corner.
    | > How can I do this?
    | > Thanks
    | > Martin Wright
    | >
    | >
    |
    |
     
    Matt W, Jun 10, 2004
    #5
  6. First, I doubt a timer is what is desired - sounds more like a progress
    dialog. But if a timer is req'd you don't need, nor should use, a timer
    control - just use Window's API calls. A google will get you more info than
    you ever wanted to know:)

    -- Mike
    ___________________________
    Mike Tuersley
    CADalyst's CAD Clinic
    Rand IMAGINiT Technologies
    ___________________________
    the trick is to realize that there is no spoon...
     
    Mike Tuersley, Jun 10, 2004
    #6
  7. Hi Martin

    On your splash form set the ShowModal property to false then in the calling routine do the following:

    frmSplash.Show
    Do your stuff
    Unload frmSplash

    I use this with my remove titlebar routine for a progress form.
    Regards - Nathan
     
    Nathan Taylor, Jun 10, 2004
    #7
  8. Thanks Nathan
    Not quite what I wanted. This removed the title bar from the autocad
    application window not the form that called the function.
    Martin
     
    Martin Wright, Jun 10, 2004
    #8
  9. Also my task bar
     
    Martin Wright, Jun 10, 2004
    #9
  10. Where are you calling it from. It needs to be called at the beginning of your splash forms activate event reason being that it is using the GetActiveWindow API function to select the form.

    Regards - Nathan
     
    Nathan Taylor, Jun 11, 2004
    #10
  11. Hi Nathan
    I found my error I called from UserForm_Initialize not UserForm_Activate

    I still need to know how I can run my code without the user interacting with
    the form.

    Thanks

    Martin


    your splash forms activate event reason being that it is using the
    GetActiveWindow API function to select the form.
     
    Martin Wright, Jun 11, 2004
    #11
  12. Also called my function from UserForm_Activate works ok but the form
    displays white!
     
    Martin Wright, Jun 11, 2004
    #12
  13. Hi Martin

    That is originally where I went to put it before realizing initialization occurs before the form becomes active.

    Does my later post about the ShowModal property help?

    Regards - Nathan
     
    Nathan Taylor, Jun 11, 2004
    #13
  14. When I tried
    frmSplash.Show
    Do your stuff
    Unload frmSplash

    the form displayed the titlebar

    when I showed the form from my initial macro with
    Private Sub UserForm_Activate()
    Label2.Caption = "Processing please wait and enjoy a cup of coffee!"
    Label2.BackColor = vbRed
    Call TitleBar.Remove
    EqNoCadFileSelectMain_2
    Unload frmSplash
    End Sub

    in the form code
    It functions as I would like except it appears to have inssufficent time to
    display the contents of the form - hence it appears white. I have assumed
    insufficent time to refresh the display is also the issue with the method
    you suggested and why the title bar remanined.
    (When this runs the whole autocad window with toolbars goes white accept the
    main window title bar.)
    It appears these computers are just too fast!! :)
    Regards
    Martin



    occurs before the form becomes active.
     
    Martin Wright, Jun 11, 2004
    #14
  15. Sorry Martin, This should fix it by using the VB/VBA DoEvents Function.

    Dim intDoEvents as Integer
    frmSplash.Show
    intDoEvents = DoEvents
    Do your stuff
    Unload frmSplash

    Regards - Nathan
     
    Nathan Taylor, Jun 11, 2004
    #15
  16. Fantastic
    Thank you I have learnt a lot
    Regards
    Martin
     
    Martin Wright, Jun 11, 2004
    #16
  17. Glad I could help.
    Regards - Nathan
     
    Nathan Taylor, Jun 11, 2004
    #17
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.