我自认为是VB寂寞高手,这是第一次提问。不服气的进来...

jokesmith 2001-08-17 07:40:27
Windows在大多数文本框或写字板上都有一个大家熟悉的右键菜单:复制/剪切/粘贴/全选/撤销。 如何编程在这个菜单上加上一项,如:转为大写。 然后我的后台程序可以检测到并作相应处理?注意:并不是指在我的VB程序里的Textbox加菜单,而是任何应用里。
...全文
453 54 打赏 收藏 转发到动态 举报
写回复
用AI写文章
54 条回复
切换为时间正序
请发表友善的回复…
发表回复
thriller 2001-08-26
  • 打赏
  • 举报
回复
如果能解决这个问题,就可以实现WindowBlinds的功能了。大家努力。
jbtan 2001-08-21
  • 打赏
  • 举报
回复
首先声明:我不在行“深入windows编程”,不过,win31和9x是不一样的。
几个疑问,望各位解答:
粗略说,在多任务操作系统中,一般都设置了内存保护,包括代码段和数据段。那么,我也不知道这个“文本框”或者“RichText框”是在那个系统DLL中,
如果不采用静态连接,应该是要调用某个DLL来实现“文本框”。
1、可是不论是hook还是subclass 方法, 如果需要改变数据的话,似乎都需要程序主动调用,才有可能,否则无法修改其他进程的数据。
2、大家见过即时汉化软件,大概利用某些机制,不过只是改变显示而已。
3、如SirCAM, 也是取得了运行主导权,才有可能。
4、可能可以修改DLL入口表,先调用自己的Code, 如某些病毒。
5、如果调用的是一个OLE Server, 比如MS Graph, 则需要改变msgraph。
请指正。
donglw 2001-08-20
  • 打赏
  • 举报
回复
希望提问的、回答的都以技术讨论为主,不要做口舌之争。
dicu 2001-08-20
  • 打赏
  • 举报
回复
大家讨论了这么多,也不只道这个寂寞高手懂不懂?
JScript 2001-08-20
  • 打赏
  • 举报
回复
哈哈,今天才去看了你的那段代码,一句话,,屁,

寂寞高手??哈哈,笑死人了,大哥真幽默。
kingxing 2001-08-19
  • 打赏
  • 举报
回复
底层改是没戏,除非C
其他的方法也就是屏蔽
象楼上的方法
jokesmith 2001-08-19
  • 打赏
  • 举报
回复
To gameboy999(我是一只小小鸟): 回复于2001-8-18 20:27:11

不知您认为什么是高明?一定要把问题用最复杂的方法解出来才算吗?这段代码借用MouseMove很好,让程序很简单,这就是高明。如果有人能用更少的代码实现它,我就认为更高明。那种按教科书一步一步来,基本上是体力劳动。
BeyondSky 2001-08-19
  • 打赏
  • 举报
回复
高手,我好仰慕你呀,呵呵,哈哈哈,知道厉害了?
gameboy999 2001-08-19
  • 打赏
  • 举报
回复
能改吗?who can,give the code first!

我只知道可以通过注册表改IE,Shell等的菜单。
sdyqingdao 2001-08-19
  • 打赏
  • 举报
回复
太简单了,楼上所说就是正确答案
需要代码吗?
firetoucher 2001-08-19
  • 打赏
  • 举报
回复
修改注册表可以重新编写右键菜单。
TBBT 2001-08-18
  • 打赏
  • 举报
回复
同意楼上的观点。

提问题吗,不要钻牛角尖,我想人家软件高手也不会整天去考虑“在这个菜单上么加点东西,在那个界面上么画个图案”什么的。软件是要有内涵的。

另外,问问题要虚心点,天外有天。当然,这不是指我。
jokesmith 2001-08-18
  • 打赏
  • 举报
回复
补充一点:
上面的代码是MSDN上的,可以直接Copy到一个Form里Run起来。
这段代码绝对精彩。各位高手,你们自问如何?
QQRN 2001-08-18
  • 打赏
  • 举报
回复
关注
jokesmith 2001-08-18
  • 打赏
  • 举报
回复
再贴一段程序。先声明两点:
1、 不是让大家看Shell_NotifyIcon,这种在任务栏加图标的东东3年前就普及了;
2、 请大家关注的是:MouseMove事件。这段程序绝对没有错。

请各位高手看后讲点实话。不要互相攻击,但要百花齐放。


'Declare a user-defined variable to pass to the Shell_NotifyIcon
'function.
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

'Declare the constants for the API function. These constants can be
'found in the header file Shellapi.h.

'The following constants are the messages sent to the
'Shell_NotifyIcon function to add, modify, or delete an icon from the
'taskbar status area.
Private Const NIM_ADD = &H0
Private Const NIM_MODIFY = &H1
Private Const NIM_DELETE = &H2

'The following constant is the message sent when a mouse event occurs
'within the rectangular boundaries of the icon in the taskbar status
'area.
Private Const WM_MOUSEMOVE = &H200

'The following constants are the flags that indicate the valid
'members of the NOTIFYICONDATA data type.
Private Const NIF_MESSAGE = &H1
Private Const NIF_ICON = &H2
Private Const NIF_TIP = &H4

'The following constants are used to determine the mouse input on the
'the icon in the taskbar status area.

'Left-click constants.
Private Const WM_LBUTTONDBLCLK = &H203 'Double-click
Private Const WM_LBUTTONDOWN = &H201 'Button down
Private Const WM_LBUTTONUP = &H202 'Button up

'Right-click constants.
Private Const WM_RBUTTONDBLCLK = &H206 'Double-click
Private Const WM_RBUTTONDOWN = &H204 'Button down
Private Const WM_RBUTTONUP = &H205 'Button up

'Declare the API function call.
Private Declare Function Shell_NotifyIcon Lib "shell32" _
Alias "Shell_NotifyIconA" _
(ByVal dwMessage As Long, pnid As NOTIFYICONDATA) As Boolean

'Dimension a variable as the user-defined data type.
Dim nid As NOTIFYICONDATA

Private Sub Command1_Click()
'Click this button to add an icon to the taskbar status area.

'Set the individual values of the NOTIFYICONDATA data type.
nid.cbSize = Len(nid)
nid.hWnd = Form1.hWnd
nid.uId = vbNull
nid.uFlags = NIF_ICON Or NIF_TIP Or NIF_MESSAGE
nid.uCallBackMessage = WM_MOUSEMOVE
nid.hIcon = Form1.Icon
nid.szTip = "Taskbar Status Area Sample Program" & vbNullChar

'Call the Shell_NotifyIcon function to add the icon to the taskbar
'status area.
Shell_NotifyIcon NIM_ADD, nid
End Sub

Private Sub Command2_Click()
'Click this button to delete the added icon from the taskbar
'status area by calling the Shell_NotifyIcon function.
Shell_NotifyIcon NIM_DELETE, nid
End Sub

Private Sub Form_Load()
'Set the captions of the command button when the form loads.
Command1.Caption = "Add an Icon"
Command2.Caption = "Delete Icon"
End Sub

Private Sub Form_Terminate()
'Delete the added icon from the taskbar status area when the
'program ends.
Shell_NotifyIcon NIM_DELETE, nid
End Sub

Private Sub Form_MouseMove _
(Button As Integer, _
Shift As Integer, _
X As Single, _
Y As Single)
'Event occurs when the mouse pointer is within the rectangular
'boundaries of the icon in the taskbar status area.
Dim msg As Long
Dim sFilter As String
msg = X / Screen.TwipsPerPixelX
Select Case msg
Case WM_LBUTTONDOWN
Case WM_LBUTTONUP
Case WM_LBUTTONDBLCLK
CommonDialog1.DialogTitle = "Select an Icon"
sFilter = "Icon Files (*.ico)|*.ico"
sFilter = sFilter & "|All Files (*.*)|*.*"
CommonDialog1.Filter = sFilter
CommonDialog1.ShowOpen
If CommonDialog1.filename <> "" Then
Form1.Icon = LoadPicture(CommonDialog1.filename)
nid.hIcon = Form1.Icon
Shell_NotifyIcon NIM_MODIFY, nid
End If
Case WM_RBUTTONDOWN
Dim ToolTipString As String
ToolTipString = InputBox("Enter the new ToolTip:", _
"Change ToolTip")
If ToolTipString <> "" Then
nid.szTip = ToolTipString & vbNullChar
Shell_NotifyIcon NIM_MODIFY, nid
End If
Case WM_RBUTTONUP
Case WM_RBUTTONDBLCLK
End Select
End Sub
Un1 2001-08-18
  • 打赏
  • 举报
回复
在Windows启动时调用你的软件,使用SetClassLong到"Edit"类的GCL_WNDPROC试试。
JScript 2001-08-18
  • 打赏
  • 举报
回复
首先:
你的问题是在VC++版里好像是由111222提出来的,你却拿来到VB版做秀,抄袭、可笑。
其次:
这样的问题,不是VB擅长的地方,用VB做会有一些难度。干吗非要用VB做自找麻烦?白痴。
最后:
就算是纯技术交流,看你的口气,令人反感。
enmity 2001-08-18
  • 打赏
  • 举报
回复
呵呵
thriller 2001-08-18
  • 打赏
  • 举报
回复
跨线程的subclass可以吗?
thriller 2001-08-18
  • 打赏
  • 举报
回复
其实这人的确不是个笨蛋,问的问题在VB中也的确是不可以,相信我,没错的。
这种底层操作本就不适合VB这种高级语言。
后面的代码虽然聪明,也不见得如何高明。
Un1的办法如果可以就好了,不过有点运气成分吧?
加载更多回复(34)

7,788

社区成员

发帖
与我相关
我的任务
社区描述
VB 基础类
社区管理员
  • VB基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧