Solved

Show splash screen at startup...................

Posted on 2004-10-10
7
642 Views
Last Modified: 2008-03-04
Hi all,
        I have developed an application using VB6......When my application is loaded it calls a few functions at Form_Load event. They include calling Compact and Repair for my database(Takes less then a Second)  as well as dialing an internet connection (GPRS connection) (Takes 8-10 Second) as well as reading some values from a huge database  (Takes 5-6 sec.) .
What I want is to display some Splash Screen displaying "Initializing" and showing progress when my program starts..... It should end when my initializing is completed.....
This is the code that I use for Interdial.......      
 InternetDial Me.hWnd, "UFone", 2&, HandleConnection, 0&

I have something like this now.......

Form_Load

SplashForm.show

Call ComapctAndRepair
Call InternetDial
Call InitializeValues

SplashForm.hide

end sub

Problems in this code::

1) The Internet Dial Screen is shown at the top of my Splash Screen. I want my splash screen to be on top of all other windows......
2) The Splash Screen is shown before the Main Form is displayed.......What I want is the main form to be showed first and then the splash screen with some animation (like progress bar)....So I want to know which event is fired after form_load is completed.......

0
Comment
Question by:imarshad
7 Comments
 
LVL 8

Assisted Solution

by:mladenovicz
mladenovicz earned 50 total points
Comment Utility
1) check Zorder method of form, or you can use API

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()
    'KPD-Team 1998
    'URL: http://www.allapi.net/
    'E-Mail: KPDTeam@Allapi.net
    '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
0
 
LVL 10

Assisted Solution

by:anv
anv earned 25 total points
Comment Utility
>>The Internet Dial Screen is shown at the top of my Splash Screen. I want my splash screen to be on top of all other windows......

in the form load evenht of the splash screen add the code to open the Main Form...


>>...So I want to know which event is fired after form_load is completed.......

Form_activate event is fired after that..
u need to be careful since it gets fired even when u bring the focus back to this form from anither aplication or form..
0
 
LVL 13

Author Comment

by:imarshad
Comment Utility
mladenovicz,
                   Your API code is working........

>>in the form load evenht of the splash screen add the code to open the Main Form...

I could not understand this point.....Do you mean that I set SplashForm as the startup form and then call MainForm.visible inside it?

Imran
0
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 
LVL 10

Expert Comment

by:anv
Comment Utility
yes exactly imarshad

thats what i mean
0
 
LVL 32

Accepted Solution

by:
Erick37 earned 150 total points
Comment Utility
You may also try running your startup events from the SplashForm like this...

Form_Load 'Main Form

    Show 'shows your main form first
    DoEvents

    SplashForm.Show vbModal 'Shows your splash screen second

end sub

'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Sub Form_Load() 'SplashForm
   
    With MainForm
    Me.ProgressBar1.Value = 0
    Me.ProgressBar1.Refresh

    .ComapctAndRepair
    ProgressBar1.Value = 25
    ProgressBar1.Refresh

    .InternetDial
    ProgressBar1.Value = 50
    ProgressBar1.Refresh

    MainFormInitializeValues
    ProgressBar1.Value = 99
    ProgressBar1.Refresh
    End With

    Unload Me

End Sub
0
 
LVL 3

Assisted Solution

by:Noel_Castillo
Noel_Castillo earned 25 total points
Comment Utility
You could also create a sub Main on module and call the form at your desired order. Then set the Sub Main as your startup :)

Sub Main
   frmMainForm.Show
   frmSplashScreen.Show 1
   frmLogIn.Show 1
   ...
   ...
End Sub
0
 
LVL 13

Author Comment

by:imarshad
Comment Utility
Sorry about the delay....I thought I had accepted the answer......

Imran
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now