【CSDN】【请问如何制作软件启动时的闪现窗体,请给出源码,谢】

drillmaster 2003-10-12 05:03:53
...全文
49 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
mfcprogrammer 2003-10-13
  • 打赏
  • 举报
回复

Platform SDK: Windows User Interface
AnimateWindow
The AnimateWindow function enables you to produce special effects when showing or hiding windows. There are three types of animation: roll, slide, and alpha-blended fade.

BOOL AnimateWindow(
HWND hwnd, // handle to window
DWORD dwTime, // duration of animation
DWORD dwFlags // animation type
);
Parameters
hwnd
[in] Handle to the window to animate. The calling thread must own this window.
dwTime
[in] Specifies how long it takes to play the animation, in milliseconds. Typically, an animation takes 200 milliseconds to play.
dwFlags
[in] Specifies the type of animation. This parameter can be one or more of the following values. Value Description
AW_SLIDE Uses slide animation. By default, roll animation is used. This flag is ignored when used with AW_CENTER.
AW_ACTIVATE Activates the window. Do not use this value with AW_HIDE.
AW_BLEND Uses a fade effect. This flag can be used only if hwnd is a top-level window.
AW_HIDE Hides the window. By default, the window is shown.
AW_CENTER Makes the window appear to collapse inward if AW_HIDE is used or expand outward if the AW_HIDE is not used.
AW_HOR_POSITIVE Animates the window from left to right. This flag can be used with roll or slide animation. It is ignored when used with AW_CENTER or AW_BLEND.
AW_HOR_NEGATIVE Animates the window from right to left. This flag can be used with roll or slide animation. It is ignored when used with AW_CENTER or AW_BLEND.
AW_VER_POSITIVE Animates the window from top to bottom. This flag can be used with roll or slide animation. It is ignored when used with AW_CENTER or AW_BLEND.
AW_VER_NEGATIVE Animates the window from bottom to top. This flag can be used with roll or slide animation. It is ignored when used with AW_CENTER or AW_BLEND.


Return Values
If the function succeeds, the return value is nonzero.

If the function fails, the return value is zero. The function will fail in the following situations:

The window uses the window region.
The window is already visible and you are trying to show the window.
The window is already hidden and you are trying to hide the window.
There is no direction specified for the slide or roll animation.
To get extended error information, call the GetLastError function.

Remarks
When using slide or roll animation, you must specify the direction. It can be either AW_HOR_POSITIVE, AW_HOR_NEGATIVE, AW_VER_POSITIVE, or AW_VER_NEGATIVE.

You can combine AW_HOR_POSITIVE or AW_HOR_NEGATIVE with AW_VER_POSITIVE or AW_VER_NEGATIVE to animate a window diagonally.

The window procedures for the window and its child windows may need to handle any WM_PRINT or WM_PRINTCLIENT messages. Dialog boxes, controls, and common controls already handle WM_PRINTCLIENT. The default window procedure already handles WM_PRINT.

Requirements
Windows NT/2000/XP: Included in Windows 2000 and later.
Windows 95/98/Me: Included in Windows 98 and later.
Header: Declared in Winuser.h; include Windows.h.
Library: Use User32.lib.

See Also
Windows Overview, Window Functions, WM_PRINT, WM_PRINTCLIENT

Platform SDK Release: August 2001 What did you think of this topic?
Let us know. Order a Platform SDK CD Online
(U.S/Canada) (International)



Requirements
Windows NT/2000/XP: Included in Windows 2000 and later.
Windows 95/98/Me: Included in Windows 98 and later.
Header: Declared in Winuser.h; include Windows.h.
Library: Use User32.lib.
See Also
Windows Overview, Window Functions, WM_PRINT, WM_PRINTCLIENT
mfcprogrammer 2003-10-13
  • 打赏
  • 举报
回复
Option Explicit
Private Const AW_BLEND = &H80000
Private Const AW_HIDE = &H10000
Private Declare Function AnimateWindow Lib "user32" (ByVal hwnd As Long, ByVal dwTime As Long, ByVal dwFlags As Long) As Long

Private Sub Form_KeyPress(KeyAscii As Integer)
Unload Me
End Sub

Private Sub Form_Load()
frmSplash.Show
DoEvents
Unload frmSplash
End Sub

Private Sub Form_Unload(Cancel As Integer)
AnimateWindow Me.hwnd, 4000&, AW_BLEND Or AW_HIDE
frmMian.Show
End Sub

Private Sub Frame1_Click()
Unload Me
End Sub

Private Sub Timer1_Timer()
Unload Me
End Sub

drillmaster 2003-10-12
  • 打赏
  • 举报
回复
瑞星杀毒软件启动时就有这个效果,由明渐暗,怎么做的呀

还有,我想把这个闪现窗体延迟为4秒钟,又是如何做的呀
kmzs 2003-10-12
  • 打赏
  • 举报
回复
要看你的程序,如果在启动时需要装入字体等工作,执行非常多的代码,那么splash才有用,否则一闪就卸了。。。
xiaohuangtao 2003-10-12
  • 打赏
  • 举报
回复
超OUTLOOK软件(正式版SmartMail1.0免费提供源码(最新版))
运行演示图:http://bbs.2ccc.com/uploads/huangtao/运行效果图.jpg
下载地址:http://bbs.2ccc.com/uploads/huangtao/smartmail1.0.rar
源码 放送
drillmaster 2003-10-12
  • 打赏
  • 举报
回复
如何加入渐明渐暗效果,非常感谢
ywpg 2003-10-12
  • 打赏
  • 举报
回复
UP

多看看MSDN
rainstormmaster 2003-10-12
  • 打赏
  • 举报
回复
在VB中如何创建闪烁(标语)屏


 

大型应用系统启动运行的时间需要很长时间,其时间会根据需要初始化的数量和用户系统的速度变化,因此在主窗口显示前,应显示一个初始化窗口,使应用程序看起来更具吸引力,因为当装载程序时不断可以向用户显示一些信息,而且可产生美观的视觉效果。例如vb、delphi在启动时均在主界面前显示一splash窗口.
---- 1. 下面是显示闪烁(标语)屏splash的一种简单方法:

option explicit
private sub form_load()
'显示主窗口
me.show
'显示splash窗口
frmsplash.show
doevents
'执行应用程序初始化
initialize
'关闭splash窗口
unload spalsh
end sub

---- 该过程代码应放在应用程序的启动窗体中。第一个show方法可使windows在屏幕上显示主窗体,下一个show方法显示闪烁屏,它是你设计的名为frmsplash的窗体.在利用show方法之后,再利用Doevents函数,以确保闪烁屏窗体的所有元数立即绘制完。Initialize函数执行应用程序在启动时需要执行的费时任务,例如,从文件中装载数据,将窗体装入内存等等。这时一切都准备就绪.

---- 2.闪烁窗体模板

---- Visual Basic 中含有许多摸板窗体,其中之一是闪烁屏。要为项目添加Splash screen 窗体,需要从project菜单中选择Add Form.在Add Form 对话框的New标签上选择Splash Screen图标,并单击Open.这样Splash Screen窗体就被添加到项目中.

---- 下列代码显示了如何定制Splash Screen 窗体摸板的实例:

option explicit
private sub form_load()
frmsplash.lbllicenseto=app.legaltrademarks
frmsplash.lblcompanyproduct=app.productname
frmsplash.lblplatform="window 98"
frmsplash.lblcopyright=app.legalcopyright
frmsplash.lblcompany=app.companyname
frmsplash.lblwarning="Warning:this program is protected" & _
"by copyright law,so don't copy "
frmsplash.show
doevents
initialize
unload frmsplash
end sub

---- 注意这里使用了app对象,该对象可以访问有关你的应用程序的信息;

---- splash screen 窗体摸板代码模块的代码如下所示:

Private Sub Form_keypress(keyascii as integer)
unload me
End sub

Private sub form_load()
lblversion.caption="version"&app.major&".
"app.minor"."app.revision
lblproductname.caption=app.title
end sub
private sub frame1_click()
unload me
End Sub



rainstormmaster 2003-10-12
  • 打赏
  • 举报
回复
用vb应用程序向导生成一个带有splash窗体的工程,自己看看代码(在标准窗体一步 把第一个复选框选中)

7,789

社区成员

发帖
与我相关
我的任务
社区描述
VB 基础类
社区管理员
  • VB基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧