Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2004-10-10
7
Medium Priority
?
680 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 200 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 100 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 10

Expert Comment

by:anv
ID: 12274947
yes exactly imarshad

thats what i mean
0
 
LVL 32

Accepted Solution

by:
Erick37 earned 600 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 100 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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
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…
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…
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…
Suggested Courses

722 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