首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > VB >

将程序窗体放到任务栏,该怎么解决

2012-03-31 
将程序窗体放到任务栏看到谷歌桌面搜索可以将自己的窗体放到语言栏相同的位置,以前还看到有将自己程序装入

将程序窗体放到任务栏
看到谷歌桌面搜索可以将自己的窗体放到语言栏相同的位置,以前还看到有将自己程序装入到快速启动栏中的,我自己试了试

VB code
hWnd = FindWindow("Shell_TrayWnd", vbNullString)hWnd = FindWindowEx(hWnd, 0, "ReBarWindow32", vbNullString)hWnd = FindWindowEx(hWnd, 0, "ToolbarWindow32", vbNullString)GetWindowRect hWnd, temprectIf hWnd <> 0 ThenSetParent Me.hWnd, hWndGetWndPic hWnd, Picture1End IfMe.Move -80, 0, Me.Width, 400

能够将程序放到快速启动栏中,但是却遮住了原来的快速启动栏图标,怎么才能让其他图标往后移动啊,再有要添加到语言栏相同的位置怎么办?添不上去


[解决办法]
你是说 System Tray 吗?

' FormMain.frm - Add an icon to the system tray.
' Copyright (c) 2001. All Rights Reserved.
' By Paul Kimmel. pkimmel@softconcepts.com
 
Option Explicit
 
' Type passed to Shell_NotifyIcon
Private Type NotifyIconData
Size As Long
Handle As Long
ID As Long
Flags As Long
CallBackMessage As Long
Icon As Long
Tip As String * 64
End Type
 
' Constants for managing System Tray tasks, foudn in shellapi.h
Private Const AddIcon = &H0
Private Const ModifyIcon = &H1
Private Const DeleteIcon = &H2
 
Private Const WM_MOUSEMOVE = &H200
Private Const WM_LBUTTONDBLCLK = &H203
Private Const WM_LBUTTONDOWN = &H201
Private Const WM_LBUTTONUP = &H202
 
Private Const WM_RBUTTONDBLCLK = &H206
Private Const WM_RBUTTONDOWN = &H204
Private Const WM_RBUTTONUP = &H205
 
Private Const MessageFlag = &H1
Private Const IconFlag = &H2
Private Const TipFlag = &H4
 
Private Declare Function Shell_NotifyIcon _
Lib "shell32" Alias "Shell_NotifyIconA" ( _
ByVal Message As Long, Data As NotifyIconData) As Boolean
 
Private Data As NotifyIconData
 
 
Private Sub Form_Load()
AddIconToTray
Visible = False
End Sub
 
Private Sub Form_Terminate()
DeleteIconFromTray
End Sub
 
Private Sub AddIconToTray()
 
Data.Size = Len(Data)
Data.Handle = hWnd
Data.ID = vbNull
Data.Flags = IconFlag Or TipFlag Or MessageFlag
Data.CallBackMessage = WM_MOUSEMOVE
Data.Icon = Icon
Data.Tip = "System Tray Demo - codeguru.com" & vbNullChar
Call Shell_NotifyIcon(AddIcon, Data)
 
End Sub
 
Private Sub DeleteIconFromTray()
Call Shell_NotifyIcon(DeleteIcon, Data)
End Sub
 
Private Sub Form_MouseMove(Button As Integer, _
Shift As Integer, X As Single, Y As Single)
 
Dim Message As Long
Message = X / Screen.TwipsPerPixelX
 
Select Case Message
Case WM_LBUTTONDBLCLK
Visible = Not Visible
WindowState = Abs(Not Visible)
End Select
End Sub

[解决办法]
应该不是system tary那一块,是输入法那一块。

[解决办法]
是挺麻烦,貌似得通过系统提供的专门接口或者所允许的方式来操作,setparent这样的属于非常规操作。
[解决办法]
系统托盘?

热点排行