Solved

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

Posted on 2004-10-10
7
675 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 8

Assisted Solution

by:mladenovicz
mladenovicz earned 50 total points
ID: 12274507
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
ID: 12274519
>>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
ID: 12274922
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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 10

Expert Comment

by:anv
ID: 12274947
yes exactly imarshad

thats what i mean
0
 
LVL 32

Accepted Solution

by:
Erick37 earned 150 total points
ID: 12275617
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
ID: 12283552
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
ID: 12316580
Sorry about the delay....I thought I had accepted the answer......

Imran
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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…
Suggested Courses
Course of the Month9 days, 3 hours left to enroll

617 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