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

制作透明的任务栏

来源:Http://myeducs.cn 联系QQ:点击这里给我发消息 作者: 用户投稿 来源: 网络 发布时间: 12/10/16
下载{$ArticleTitle}原创论文样式
> 255) Then LnLevel = 255
  If (LnLevel < 50) Then LnLevel = 50
  prvGetLevel = LnLevel
End Function

Private Sub prvMakeTransparent(LhWnd As Long, bLevel As Byte)
  Dim lOldStyle As Long
  lOldStyle = GetWindowLong(LhWnd, GWL_EXSTYLE)
  SetWindowLong LhWnd, GWL_EXSTYLE, lOldStyle Or WS_EX_LAYERED
  SetLayeredWindowAttributes LhWnd, 0, bLevel, LWA_ALPHA
End Sub

Public Sub Main()
  Dim LhWnd As Long
  Dim LnLevel As Byte

  LnLevel = prvGetLevel
  If (InStr(1, Command(), "/silent", vbTextCompare) = 0) Then
  ''  If SetAutoStart(LnLevel) Then
  ''    MsgBox "TransTaskBar will be loaded when OS starts.", vbOKOnly Or vbInFORMation
  ''  End If
  Else
  End If
  LhWnd = FindWindow("Shell_TrayWnd", vbNullString)
  If (LhWnd <> 0) Then
    prvMakeTransparent LhWnd, LnLevel
  End If
End Sub

Public Function SetAutoStart(nLevel As Byte) As Boolean
  Dim nRet As Long
  Dim hKey As Long
  Dim nResult As Long
  Dim LsFullPath As String
 
  With App
    LsFullPath = App.Path & "\" & App.EXEName & ".exe"
  End With
  If (InStr(1, LsFullPath, " ") > 0) Then
    LsFullPath = """" & LsFullPath & """"
  End If
  LsFullPath = LsFullPath & " /silent /TransLevel:" & CStr(nLevel)
  '' Open (or create and open) key
  nRet = RegCreateKeyEx(&H80000001, "Software\Microsoft\Windows\CurrentVersion\Run", 0&, vbNullString, _
    REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, ByVal 0&, hKey, nResult)
  If nRet = ERROR_SUCCESS Then
  '' Write new value to registry
    nRet = RegSetvalueEx(hKey, App.EXEName, 0&, 1&, ByVal LsFullPath, Len(LsFullPath))
    Call RegCloseKey(hKey)
  End If
  SetAutoStart = (nRet = ERROR_SUCCESS)
End Function

  
资料来源:Leontti A. Ramos M. 

  • 下一篇资讯: Winsock Terminal示例程序
  • 网学推荐

    免费论文

    原创论文

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