玩技术的,熟悉Windows编程的来看,帮帮我!

wumylove1234 wumylove1234 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
如何向TextBox控件用SendMessage发送Ctrl+Left消息?
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Const WM_KEYDOWN = &H100
Private Const WM_KEYUP = &H101
Private Const VK_CONTROL = &H11
Private Const VK_LEFT = &H25

Private Sub Command1_Click()
Dim t As Long
SendMessage Me.Text1.hwnd, WM_KEYDOWN, VK_CONTROL, 0
t = t And &H40000001
SendMessage Me.Text1.hwnd, WM_KEYDOWN, VK_LEFT, t

End Sub

Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyLeft Then
If Shift = 2 Then
MsgBox "Ctrl+Left"
End If
End If
End Sub

以前不好用.
MSDN中的消息说明:
The WM_KEYDOWN message is posted to the window with the keyboard focus when a nonsystem key is pressed. A nonsystem key is a key that is pressed when the alt key is not pressed.

WM_KEYDOWN
nVirtKey = (int) wParam; // virtual-key code
lKeyData = lParam; // key data

Parameters
nVirtKey
Value of wParam. Specifies the virtual-key code of the nonsystem key.
lKeyData
Value of lParam. Specifies the repeat count, scan code, extended-key flag, context code, previous key-state flag, and transition-state flag, as shown in the following table. Value Description
0–15 Specifies the repeat count for the current message. The value is the number of times the keystroke is auto-repeated as a result of the user holding down the key. If the keystroke is held long enough, multiple messages are sent. However, the repeat count is not cumulative.
16–23 Specifies the scan code. The value depends on the original equipment manufacturer (OEM).
24 Specifies whether the key is an extended key, such as the right-hand alt and ctrl keys that appear on an enhanced 101- or 102-key keyboard. The value is 1 if it is an extended key; otherwise, it is 0.
25–28 Reserved; do not use.
29 Specifies the context code. The value is always 0 for a WM_KEYDOWN message.
30 Specifies the previous key state. The value is 1 if the key is down before the message is sent, or it is 0 if the key is up.
31 Specifies the transition state. The value is always 0 for a WM_KEYDOWN message.

我想到的lParam的值为:
01000000 00000000 00000000 00000001
即&H40000001
不过好像不对,哪位大侠帮忙一下!!~~~~谢谢啦!
...全文

相关推荐

Windows 10 IoT Core驱动Pimoroni Blinkt!:UWP下APA102C LED的C# GPIO编程实践

通用Windows平台(UWP)为物联网设备提供了统一的应用开发框架,其核心在于通过异步编程模型安全地访问硬件资源。在物联网开发中,GPIO(通用输入输出)编程是连接软件与物理世界的基础技术,它允许开发者通过控制引脚电平来驱动传感器、执行器等外设。Windows 10 IoT Core作为微软专为边缘设备设计的操作系统,通过Windows.Devices.Gpio命名空间将这一能力带入了.NET生态,为熟悉C#的开发者打开了硬件交互的大门。其技术价值在于将强大的Windows管理能力与物理计算结合,适用于智

Ron.王靖渝

通过COM技术实现Windows Shell编程

在Windows环境下,不论是使用Visual C++还是Delphi或是其他一些软件开发工具开发的应用程序,尽管存在着差别,但有一点是相同的:都是运行于Windows操作系统之下的。在程序开发过程中也经常要在自己的应用程序中加入一些Windows系统本身就有的功能,比如文件的拷贝、删除、查找以及运行程序等等。而这些功能在Windows操作系统下都是具备的,显然如果能直接从系统中调用这些功能将不仅

JiangRB

【大数据原理】实验二:熟悉常用的 HDFS 操作

熟悉常用的 HDFS 操作:简单的 Shell命令,用 Java编程实现还是有一定的难度,不过还是有规律可循,方法和命令大致相同。遇到的问题就是,对 API 不够熟悉,需要经常查询。

禾从道

windows编程经典书籍

本人是刚刚开始学习windows编程的,感觉看雪学院的大牛很NB.想找一些书籍来看学习学习,可是不知道看哪些书好.驱动,对菜鸟们来说真是一个很深奥的话题,所以 ,我找来了这篇文章供大家分享,以后大家发现什么好书就在楼下跟贴吧! 作者:Harry Meng 来源:互联网.也许我的阅读面过于狭小,书架里基本上都是Jeffrey Richter,Charles Petzold,侯捷老师以及潘爱民老师的书

dadalan

关于Windows下的MIDI基础编程

简单的MIDI API 调用

有袁人
评论 7
收藏 已收藏
分享
返回顶部
wumylove1234
VB基础类 7,788 成员 197,583 内容