D ''在窗口的样式中加入子窗体常数
SetWindowLong FRMmain.hwnd, GWL_STYLE, Style ''改变窗体的样式
SetParent FRMmain.hwnd, LookScrWnd ''设置窗体的父窗体
GetClientRect LookScrWnd, LookRect ''取得小屏幕的大小
SetWindowPos FRMmain.hwnd, HWND_TOP, 0, 0, LookRect.Right, LookRect.Bottom, SWP_NOZORDER Or SWP_NOACTIVATE Or SWP_SHOWWINDOW
''显示窗体并将窗体的大小设置为小屏幕的大小以便覆盖小屏幕
End Sub
Public Sub Scr_Run()
FRMmain.Caption = WM_RUN ''赋上具有相应运行方式的标题
ShowCursor False
SetWindowPos FRMmain.hwnd, HWND_TOP, 0, 0, Screen.Width, Screen.Height, SWP_SHOWWINDOW
''将屏保放在所有窗口的前面,并全屏幕显示
End Sub
Public Sub CloseSCR()
ShowCursor True ''显示鼠标
Unload FRMmain ''同上
If preview = True Then FRMshell.Show
End Sub
Public Function Scan_RUN() As Boolean ''侦测当前屏保的运行方式
If (FRMmain.Caption = WM_RUN) Then ''如果屏保是以运行方式在运行则返回"真",否则返回"假"
Scan_RUN = True
Else
Scan_RUN = False
End If
End Function
Option Explicit ''FRMshell
Private Sub command1_Click()
Dlg1.DialogTitle = "请打开你喜欢的图象文件或声音文件"
Dlg1.FileName = "*.bmp;*.jpg;*.gif;*.wav"
Dlg1.ShowOpen
On Error GoTo exitpic
If Right(Dlg1.FileName, 3) = "wav" Or Right(Dlg1.FileName, 3) = "WAV" Then
sndPlaySound Dlg1.FileName, 1 ''播放选择的音乐
Else
Image1.Picture = LoadPicture(Dlg1.FileName)
End If
Command2.Enabled = True
Exit Sub
exitpic: ''错误捕捉——为了防止用户没有选择图象文件或声音文件就退出
End
End Sub
Private Sub Command2_Click()
Open "c:\在屏保制作
程序中你选择的图象和声音文件.txt" For Append As #1 ''建立并打开我的文档下的文件,为了把选择的图片和声音记录下来
Print #1, Dlg1.FileName
Close #1
Command2.Enabled = False
Command3.Enabled = True
Command4.Enabled = True
End Sub
Private Sub Command3_Click()
preview = True
ShowCursor False
FRMmain.Show
End Sub
Private Sub command4_Click()
Unload Me
End Sub
Private Sub Form_Load()
FRMshell.Caption = "新奇而笨拙的屏保"
Image1.Stretch = True
On Error Resume Next
Image1.Picture = LoadPicture(App.Path & "\背景.jpg")
Open "c:\在屏保制作
程序中你选择的图象和声音文件.txt" For Output As #1 ''建立并打开我的文档下的文件,为了把选择的图片和声音记录下来
Close #1 ''清空上次运行本
程序时存放在该文件里的图象和声音文件名
Command