我自定义了个窗口borderStyle为3,contorlbox为false,caption为空,又想在任务栏中显示“XXXX正在运行”,不知道有没有办法?
解决方案 »
- Treeview控件里的层如果还有子层,那么如何让层前面显示“+”
- 已知圆点坐标和半径,如何枚举圆边的每一点坐标?
- 在使用mscomm控件为rs232做通信时,只能收到小于8个字节,为什么?请指教
- 关于VB......(来者有分)
- 用VB开发数据库应用有什么好的第三方控件?有没有可以做出Xp风格界面的控件?
- 怎样增加listbox的容纳数量呢?(在线等待+高分回报)
- 双系统疑难杂症集锦?
- 有关进度条的使用
- 高难度问题!100分求救!For Each语句在ActiveReport中使用!
- ado中如何才能支持数据的更新
- 求解决方法:VB中普通打印机,A4纸打印条形码
- 我中专毕业想系统学习一下计算机请问如何学?
Private Type NOTIFYICONDATA
cbSize As Long
hWnd As Long
uId As Long
uFlags As Long
ucallbackMessage As Long
hIcon As Long
szTip As String * 64
End Type
Private Const NIM_ADD = &H0
Private Const NIM_MODIFY = &H1
Private Const NIM_DELETE = &H2
Private Const NIF_MESSAGE = &H1
Private Const NIF_ICON = &H2
Private Const NIF_TIP = &H4
Private Const WM_LBUTTONDBLCLK = &H203
Private Const WM_LBUTTONDOWN = &H201
Private Const WM_RBUTTONUP = &H205
Private Const WM_LBUTTONUP = &H202Private Declare Function Shell_NotifyIcon Lib "shell32" Alias "Shell_NotifyIconA" (ByVal dwMessage As Long, pnid As NOTIFYICONDATA) As Boolean
Private TrayI As NOTIFYICONDATA
Private Sub Form_Load()
Dim i As Integer Me.Hide
With TrayI
.cbSize = Len(TrayI)
.hWnd = Me.hWnd
.uId = 1&
.uFlags = NIF_ICON Or NIF_TIP Or NIF_MESSAGE
.ucallbackMessage = WM_LBUTTONDOWN
.hIcon = imgIcon(2).Picture '这里是显示的图标
.szTip = "程序正在运行" & Chr$(0) '这里是任务栏显示的字
Shell_NotifyIcon NIM_ADD, TrayI
End With
TimerReplaceIcon.Enabled = True
End Sub
With TrayI
.uFlags = 0
End With
Shell_NotifyIcon NIM_DELETE, TrayI
End Sub
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Dim Msg As Integer
On Error Resume Next
Msg = X / Screen.TwipsPerPixelX
If Msg = WM_RBUTTONUP Then
'弹出右键菜单。
'PopupMenu mnuNotifyRight
ElseIf Msg = WM_LBUTTONDBLCLK Then MsgBox "您双击了我"
End If
End Sub
人家的意思是 一个无标题的窗体!! 当运行的时候 任务栏上没有文字 就一个空白。这个问题我也遇到过
我现在可以在任务栏上显示图标
Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long
Private
Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Private Sub Form_Load()
ShowIcon Me.hwnd
End SubFunction ShowIcon(m_hwnd As Long)
Dim lStyle As Long
lStyle = GetWindowLong(m_hwnd, GWL_STYLE) Or WS_SYSMENU
SetWindowLong m_hwnd, GWL_STYLE, lStyle
End Function
2. 將窗體的ShowInTaskbar屬性設置為True.
1. 首先在project菜單下的property對話框里,在project name填上你想要的工程名稱
2. 將窗體的ShowInTaskbar屬性設置為True.没有用啊,看来不行啊!
SetWindowText Me.hwnd, "lxcc Test"
End SubPrivate Sub Form_DblClick()
End
End Sub
不好意思 没有声明常量 声明就好用了 但只能显示图标!
只要把你的窗口设为无标题就可以了!在任务栏上显示文字 我也实现不了
但 在用(叶凡)的api浏览器的时候看到他可以实现,但问他没有告诉!没有理我!!哈哈:(Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long
Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Private Const WS_SYSMENU = &H80000
Private Const GWL_STYLE = (-16)Private Sub Form_Load()
ShowIcon Me.hwnd
End SubFunction ShowIcon(m_hwnd As Long)
Dim lStyle As Long
lStyle = GetWindowLong(m_hwnd, GWL_STYLE) Or WS_SYSMENU
SetWindowLong m_hwnd, GWL_STYLE, lStyle
End Function
Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Private Const WS_SYSMENU = &H80000
Private Declare Function SetWindowText Lib "user32" Alias "SetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String) As Long
Private Const GWL_STYLE = (-16)Private Sub Form_Load()
ShowIcon Me.hwnd
SetWindowText Me.hwnd, "***标题***"
End SubFunction ShowIcon(m_hwnd As Long)
Dim lStyle As Long
lStyle = GetWindowLong(m_hwnd, GWL_STYLE) Or WS_SYSMENU
SetWindowLong m_hwnd, GWL_STYLE, lStyle
End Function