老兄:
你的问题在于你点击任务栏的时候,焦点已转移到任务栏上了。
form1.show只是把自己显示出来
再加一个API激活就OK了我有一问:
你那句msg = X / Screen.TwipsPerPixelX
是那找来的???
蛮经典的!
可怎么理解呢?
谢谢。
你的问题在于你点击任务栏的时候,焦点已转移到任务栏上了。
form1.show只是把自己显示出来
再加一个API激活就OK了我有一问:
你那句msg = X / Screen.TwipsPerPixelX
是那找来的???
蛮经典的!
可怎么理解呢?
谢谢。
解决方案 »
- vb怎样在textbox中显示数据库数据相加后的结果
- 各位高手,求救!在VB工程文件夹中加入控件后窗体不能打开,怎样解决?
- 帮忙改写一个脚本,实现一个模糊匹配的问题
- 请问如何在picturebox中显示小图标以及透明图标!急!
- VB如何实现NT/2000/xp下的IO端口操作?有现成的动态库吗?
- 我在前台的程序中对text1.text=rs!number,为何text1.text的值还是空值,想不通???
- 请大家帮忙,不胜感激,“退出时报错..."
- 关于SQL查询的问题,我怎样查一个数据库里有一个字段内容相的记录条数!
- 在VB中,用CommonDialog.ShowOpen如何使打开的“打开对话框”不是显示有列表的那种,而是显示无列表的那种“打开对话框”,就像VC中的一
- vb datalist 控件怎么用
- 怎样从IE缓存中提到网页文件
- 关于windows media player
If me.scale = vbpixels then
msg = x
else
msg = X / Screen.TwipsPerPixelX
end if
不知道对各位有无帮助。我还是看不懂。
Form1.SetFocus
或直接用Form1.Show也可以To:Didy
form1.show 就把自己显示出来并激活。When you pass the mouse pointer over the icon in the taskbar status area, the form receives the message WM_MOUSEMOVE. This message maps to the form's MouseMove event. The X argument is the product of one of the mouse constants that indicates the mouse input (such as a left-click, right-click, single-click, or double-click) and the TwipsPerPixelX property of the screen. The mouse input is produced by dividing the X argument with this property. The mouse input is then used in a Select Case statement to execute a series of instructions.
From MSDN
我也是抄来的,不过王国荣那本书上不是这样处理的。
.setfocus
我试了,不行。
Static RR As Boolean
'x is the current mouse location along the x-axis
Message = X / Screen.TwipsPerPixelX
If RR = False Then
RR = True
Select Case Message
' Left double click (This should bring up a dialog box)
Case WM_LBUTTONDBLCLK
Me.Show
' Right button up (This should bring up a menu)
Case WM_RBUTTONUP
Me.Hide 'PopupMenu mnuPopUp
End Select
RR = False
End If
End Sub
我把它设置为topmost了,
但还是不太正常。我把showintaskbar打开,则可以观察到:
当双击托盘图标后,窗口弹出,窗口标题栏闪动,同时任务栏也闪动(蓝,白)。
闪几下后,窗口正常,但任务栏依然是蓝底。而原来的窗口显示依然为有
焦点状,对应任务栏依然凹下,呈焦点壮。
点击弹出窗口后,一切正常。
用SYSTRAY控件则没有这些情况。
SetActiveWindow来试试。
也许是我的98或VB有问题吧。
劳动各位大虾了
msg = X / Screen.TwipsPerPixelX
x返回的是鼠标移动的横向位置,或是鼠标按键按下的信息,单位是twip
而msg的单位是pixel.
我是这样理解的。