当前位置: 网学 > 编程文档 > VB > 正文

一个新奇和笨拙的VB屏保

来源:Http://myeducs.cn 联系QQ:点击这里给我发消息 作者: 用户投稿 来源: 网络 发布时间: 12/10/16
下载{$ArticleTitle}原创论文样式
wPos 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) As Long
    Declare Function ShowCursor Lib "user32" (ByVal bShow As Long) As Long
    Declare Function sndPlaySound Lib "winmm.dll" Alias "sndPlaySoundA" (ByVal lpszSoundName As String, ByVal uFlags As Long) As Long

    ''MODmain
    ''Option Explicit  ''为了在FRMshell卸载之后仍能运行,必须将这行注释掉
    Public preview As Boolean ''true是试试屏保效果,false是真正的屏保

    Sub Main() ''程序运行入口
    Dim ClassName As String * 64  ''存放窗口的类名
    Dim ExeCmd As String ''存放命令行参数
    GetClassName FRMmain.hwnd, ClassName, 64 ''取得窗口的类名
    ExeCmd = UCase(Command$) ''将调用的屏保的参数转换成大写后存放在变量ExeCmd里
    If Not (InStr(ExeCmd, "/P") = 0) Then ''检查屏保的调用参数中是否有"/P"参数
        If FindWindow(ClassName, WM_LOOK) <> 0 Then End  ''如果找到已有同一个运行方式的实例存在则程序结束
        ClosePreWindow ClassName, WM_RUN ''同上
        Scr_Look
    ElseIf Not (InStr(ExeCmd, "/S") = 0) Then
        If FindWindow(ClassName, WM_RUN) <> 0 Then End
        ClosePreWindow ClassName, WM_LOOK ''同上
        Scr_Run
    Else
        ClosePreWindow ClassName, WM_LOOK ''同上
        ClosePreWindow ClassName, WM_RUN ''同上
        Scr_Run
    End If
    End Sub
    Public Sub ClosePreWindow(ClassName As String, WinCaption As String)
    Dim PreWnd As Long
    PreWnd = FindWindow(ClassName, WinCaption) ''寻找类名为ClassName,标题为WinCaption的窗口
    If Not (PreWnd = 0) Then Call SendMessage(PreWnd, WM_CLOSE, 0, 0) ''如果窗口已找到则关闭它
    End Sub
  
    Public Sub Scr_Look()
    Dim LookScrWnd As Long
    Dim Style As Long
    Dim LookRect As RECT
    FRMmain.Caption = WM_LOOK ''赋上具有相应运行方式的标题
    LookScrWnd = Val(Right(Command$, Len(Command$) - 2)) ''取得小屏幕的窗口句柄
    Style = GetWindowLong(FRMmain.hwnd, GWL_STYLE) ''取得窗口的样式
    Style = Style Or WS_CHIL

网学推荐

免费论文

原创论文

浏览:
设为首页 | 加入收藏 | 论文首页 | 论文专题 | 设计下载 | 网学软件 | 论文模板 | 论文资源 | 程序设计 | 关于网学 | 站内搜索 | 网学留言 | 友情链接 | 资料中心
版权所有 QQ:3710167 邮箱:3710167@qq.com 网学网 [Myeducs.cn] 您电脑的分辨率是 像素
Copyright 2008-2015 myeducs.Cn www.myeducs.Cn All Rights Reserved
湘ICP备09003080号