+ Reply to Thread
Results 1 to 10 of 10

Splash screens from VBA!

  1. #1
    Robert Mulroney
    Guest

    Splash screens from VBA!

    I'm really excited beacuse I've just learned how to remove the title bar from
    a form in vba - thought I'd better share. You need to use windows API calls
    so I suppose it's not strictly vba but very exciting nevertheless. It's going
    to be splash screens a-go-go for my addin's from now on.

    Simply add the following code to a new form in excel.

    ________________________________________________________________

    Private Const GWL_STYLE = (-16)
    Private Const WS_CAPTION = &HC00000
    Private Const WS_MAXIMIZEBOX = &H10000
    Private Const WS_MINIMIZEBOX = &H20000
    Private Const WS_SYSMENU = &H80000


    Private Declare Function FindWindow Lib "user32" Alias _
    "FindWindowA" (ByVal lpClassName As String, ByVal _
    lpWindowName As String) As Long

    Private Declare Function GetWindowLong Lib "user32" Alias _
    "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex _
    As Long) As Long

    Private Declare Function SetWindowLong Lib "user32" Alias _
    "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex _
    As Long, ByVal dwNewLong As Long) As Long

    Private Declare Function SendMessage Lib "user32" Alias _
    "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, _
    ByVal wParam As Integer, ByVal lParam As Long) As Long

    Private Declare Function DrawMenuBar Lib "user32" (ByVal _
    hwnd As Long) As Long

    Private wHandle As Long

    Private Sub UserForm_Initialize()
    Dim lStyle As Long

    If Val(Application.Version) >= 9 Then
    wHandle = FindWindow("ThunderDFrame", Me.Caption)
    Else
    wHandle = FindWindow("ThunderXFrame", Me.Caption)
    End If
    If wHandle = 0 Then Exit Sub

    lStyle = GetWindowLong(wHandle, GWL_STYLE)
    Me.Caption = ""
    lStyle = lStyle And Not WS_SYSMENU
    lStyle = lStyle And Not WS_MAXIMIZEBOX
    lStyle = lStyle And Not WS_MINIMIZEBOX
    lStyle = lStyle And Not WS_CAPTION

    SetWindowLong wHandle, -20, frm
    SetWindowLong wHandle, GWL_STYLE, lStyle
    DrawMenuBar wHandle
    End Sub

    __________________________________________________________________


    - Rm

  2. #2
    JMB
    Guest

    RE: Splash screens from VBA!

    Thanks!

    "Robert Mulroney" wrote:

    > I'm really excited beacuse I've just learned how to remove the title bar from
    > a form in vba - thought I'd better share. You need to use windows API calls
    > so I suppose it's not strictly vba but very exciting nevertheless. It's going
    > to be splash screens a-go-go for my addin's from now on.
    >
    > Simply add the following code to a new form in excel.
    >
    > ________________________________________________________________
    >
    > Private Const GWL_STYLE = (-16)
    > Private Const WS_CAPTION = &HC00000
    > Private Const WS_MAXIMIZEBOX = &H10000
    > Private Const WS_MINIMIZEBOX = &H20000
    > Private Const WS_SYSMENU = &H80000
    >
    >
    > Private Declare Function FindWindow Lib "user32" Alias _
    > "FindWindowA" (ByVal lpClassName As String, ByVal _
    > lpWindowName As String) As Long
    >
    > Private Declare Function GetWindowLong Lib "user32" Alias _
    > "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex _
    > As Long) As Long
    >
    > Private Declare Function SetWindowLong Lib "user32" Alias _
    > "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex _
    > As Long, ByVal dwNewLong As Long) As Long
    >
    > Private Declare Function SendMessage Lib "user32" Alias _
    > "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, _
    > ByVal wParam As Integer, ByVal lParam As Long) As Long
    >
    > Private Declare Function DrawMenuBar Lib "user32" (ByVal _
    > hwnd As Long) As Long
    >
    > Private wHandle As Long
    >
    > Private Sub UserForm_Initialize()
    > Dim lStyle As Long
    >
    > If Val(Application.Version) >= 9 Then
    > wHandle = FindWindow("ThunderDFrame", Me.Caption)
    > Else
    > wHandle = FindWindow("ThunderXFrame", Me.Caption)
    > End If
    > If wHandle = 0 Then Exit Sub
    >
    > lStyle = GetWindowLong(wHandle, GWL_STYLE)
    > Me.Caption = ""
    > lStyle = lStyle And Not WS_SYSMENU
    > lStyle = lStyle And Not WS_MAXIMIZEBOX
    > lStyle = lStyle And Not WS_MINIMIZEBOX
    > lStyle = lStyle And Not WS_CAPTION
    >
    > SetWindowLong wHandle, -20, frm
    > SetWindowLong wHandle, GWL_STYLE, lStyle
    > DrawMenuBar wHandle
    > End Sub
    >
    > __________________________________________________________________
    >
    >
    > - Rm


  3. #3
    Sean Connolly
    Guest

    RE: Splash screens from VBA!

    Very Cool!

    Thanks Robert, Sean.

  4. #4
    David
    Guest

    RE: Splash screens from VBA!

    Thanks for that Robert.
    .... please tell me, what is the usual method for keeping the splash screen
    loaded for a given time interval, and also perhaps letting the user "skip the
    intro" and close the splash screen early?

    Robert, just one more question, hope you don't mind....
    You are obviously a man who is keen on good presentation. Have you come
    across an Exel way to mimic web page button graphics, ie button image
    graphics change with mouse move (over the image) and then change back again
    with mouse move away from the button image?

    --
    David

  5. #5
    Bob Phillips
    Guest

    Re: Splash screens from VBA!

    David,

    Take a look at http://www.xldynamic.com/source/xld.xlFAQ0007.html

    --

    HTH

    RP
    (remove nothere from the email address if mailing direct)


    "David" <[email protected]> wrote in message
    news:[email protected]...
    > Thanks for that Robert.
    > ... please tell me, what is the usual method for keeping the splash screen
    > loaded for a given time interval, and also perhaps letting the user "skip

    the
    > intro" and close the splash screen early?
    >
    > Robert, just one more question, hope you don't mind....
    > You are obviously a man who is keen on good presentation. Have you come
    > across an Exel way to mimic web page button graphics, ie button image
    > graphics change with mouse move (over the image) and then change back

    again
    > with mouse move away from the button image?
    >
    > --
    > David




  6. #6
    David
    Guest

    Re: Splash screens from VBA!

    Thanks Bob
    --
    David

  7. #7
    David
    Guest

    Re: Splash screens from VBA!

    Hello again Bob,
    re my reply to RM,
    Have you any idea where I could get info on image change with MouseMove and
    change back again when the mouse moves away, to mimic user selection
    'buttons' often seen on web pages? Maybe mousemove is not the best way?
    Thanks again
    --
    David

  8. #8
    Bob Phillips
    Guest

    Re: Splash screens from VBA!

    David,

    I have some code that creates tooltips on mouseover. Might be possible to
    adapt to change button details. Any use?

    --

    HTH

    RP
    (remove nothere from the email address if mailing direct)


    "David" <[email protected]> wrote in message
    news:[email protected]...
    > Hello again Bob,
    > re my reply to RM,
    > Have you any idea where I could get info on image change with MouseMove

    and
    > change back again when the mouse moves away, to mimic user selection
    > 'buttons' often seen on web pages? Maybe mousemove is not the best way?
    > Thanks again
    > --
    > David




  9. #9
    David
    Guest

    Re: Splash screens from VBA!

    Yes please Bob,
    thanks again
    --
    David

    "Bob Phillips" wrote:

    > David,
    >
    > I have some code that creates tooltips on mouseover. Might be possible to
    > adapt to change button details. Any use?
    >
    > --
    >
    > HTH
    >
    > RP
    > (remove nothere from the email address if mailing direct)
    >
    >
    > "David" <[email protected]> wrote in message
    > news:[email protected]...
    > > Hello again Bob,
    > > re my reply to RM,
    > > Have you any idea where I could get info on image change with MouseMove

    > and
    > > change back again when the mouse moves away, to mimic user selection
    > > 'buttons' often seen on web pages? Maybe mousemove is not the best way?
    > > Thanks again
    > > --
    > > David

    >
    >
    >


  10. #10
    Registered User
    Join Date
    08-16-2010
    Location
    Denmark
    MS-Off Ver
    Excel 2003
    Posts
    1

    Re: Splash screens from VBA!

    Please tell me, what is the line:
    SetWindowLong wHandle, -20, frm
    - doing, apart from creating a debugging error?

    Pete

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1