Solved

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

Posted on 2004-10-10
7
668 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
Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

 
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

MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

Question has a verified solution.

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

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

734 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