Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to create a splash screen in VFP 9?

478 views
Skip to first unread message

Peter

unread,
Apr 5, 2005, 7:01:02 PM4/5/05
to
I want to create a splash screen in VFP 9 before users can see the
application menu. The splash screen needs to last long enough so the
application can finish its initialization. I wonder whether I should use
the splash screen foundation classs or not.

Mark McCasland

unread,
Apr 5, 2005, 11:00:32 PM4/5/05
to
All you really need to do is display a modeless form with no titlebar. You
can do this with CREATEOBJECT('form'), set a few properties, throw a label
on the form to say whatever you want to the user, then SHOW(0) the form.
After all your app init is done, just RELEASE() the form.

"Peter" <Pe...@discussions.microsoft.com> wrote in message
news:6C32FA76-AF4E-4AD0...@microsoft.com...

Lee Mitchell

unread,
Apr 6, 2005, 11:46:50 AM4/6/05
to
Hi Peter:

Take a look at these articles and see if they help:
http://support.microsoft.com/default.aspx?scid=KB;EN-US;138497
http://support.microsoft.com/default.aspx?scid=KB;EN-US;186010

I think there may be some more examples available on Universalthrea.com. Go
to www.universalthread.com, click on the Download icon, and choose Visual
FoxPro as the product. In the Summary text box of the query page, search
for "splash."


I hope this helps.

This posting is provided "AS IS" with no warranties, and confers no rights.

Sincerely,
Microsoft FoxPro Technical Support
Lee Mitchell

*-- VFP9 HAS ARRIVED!! --*
Read about all the new features of VFP9 here:
http://msdn.microsoft.com/vfoxpro/

*--Purchase VFP 9.0 here:
http://www.microsoft.com/PRODUCTS/info/product.aspx?view=22&pcid=54787e64-52
69-4500-8bf2-3f06689f4ab3&type=ovr

Keep an eye on the product lifecycle for Visual FoxPro here:
http://support.microsoft.com/default.aspx?id=fh;[ln];lifeprodv
- VFP5 Mainstream Support retired June 30th, 2003
- VFP6 Mainstream Support retired Sept. 30th, 2003

Olaf Doschke

unread,
Apr 8, 2005, 5:53:32 PM4/8/05
to
Hi Peter,

> I wonder whether I should use the splash screen foundation classs or not.

How about a sloly fading in and out Splashscreen?

This program quits after poForm.Show(), therefore
I defined poForm as public. You may release poForm
when you are finished with your startup code.

<splashscreen.prg>
Public poForm

* Choose whatever picture can be displayed with an Image Control
* in your Foxpro version:
poForm = Createobject("Splashform",GetPict("BMP"))
poForm.Show()

Define Class Splashform As Form
ControlBox = .F.
ShowWindow = 2 && "SetLayeredWindowAttributes" works only with this setting
Add Object Image1 As Image

Procedure Init()
Lparameters tcPathtoImage

With This
.Caption = "Splashtestdummy"
.Image1.Picture = tcPathtoImage
.Width = This.Image1.Width
.Height = This.Image1.Height+24
.AutoCenter = .T.

* The Timer only works, if width and height
* are known, so this has to be added at runtime:
.AddObject("OpacityTimer1","OpacityTimer")
Endwith
Endproc
Enddefine

Define Class OpacityTimer As Timer
*cOpacityformula = "tnTime/this.nEnd"
cOpacityformula = "SIN((4*((tnTime/this.nEnd)-.5)^3+.5)*3.1415)"

nCountCalls = 0.0
* nEnd = Duration in Seconds (ca.)
nEnd = 4
Enabled = .F.
Interval = 25

Procedure Init()
Declare Integer GetWindowLong In user32;
INTEGER HWnd, Integer nIndex

Declare Integer SetWindowLong In user32;
INTEGER HWnd, Integer nIndex, Integer dwNewLong

Declare Integer SetLayeredWindowAttributes In user32;
INTEGER HWnd, Integer crKey,;
SHORT bAlpha, Integer dwFlags

Declare Integer CreateRectRgn In gdi32;
INTEGER nLeftRect,;
INTEGER nTopRect,;
INTEGER nRightRect,;
INTEGER nBottomRect

Declare SetWindowRgn In user32;
INTEGER HWnd,;
INTEGER hRgn,;
SHORT bRedraw

Local hRgn
hRgn = CreateRectRgn (4,30, Thisform.Width-8, Thisform.Height-33)
= SetWindowRgn (Thisform.HWnd, hRgn, 1)

This.setOpacity(0.0)
This.Enabled = .T.
Endproc

Procedure Timer()
Local T1
T1 = This.nCountCalls * This.Interval/1000
If T1>This.nEnd
T1=This.nEnd
Endif
This.setOpacity(T1)
This.nCountCalls = This.nCountCalls + 1
If T1=This.nEnd
This.Enabled = .F.
Thisform.Release()
Endif
Endproc

Procedure setOpacity()
Lparameters tnTime
#Define LWA_COLORKEY 1
#Define LWA_ALPHA 2
#Define GWL_EXSTYLE -20
#Define WS_EX_LAYERED 0x80000

Local lnOpacity, nExStyle
lnOpacity = Int(255*Evaluate(This.cOpacityformula))
nExStyle = GetWindowLong(Thisform.HWnd, GWL_EXSTYLE)
nExStyle = Bitor(nExStyle, WS_EX_LAYERED)
= SetWindowLong(Thisform.HWnd, GWL_EXSTYLE, nExStyle)
= SetLayeredWindowAttributes(Thisform.HWnd, 0, lnOpacity, LWA_ALPHA)
Endproc
Enddefine
</splashscreen.prg>


Dan Freeman

unread,
Apr 8, 2005, 6:06:06 PM4/8/05
to
Showoff!

<g>

(very nice!)

Dan

0 new messages