向旧应用程序发送窗口消息
我开发了一个使用WindowsMessage控制其他窗口的应用程序。它与我的示例应用程序一起成功运行,该应用程序是由 C# 构建的。 然而,然后我尝试使用由 VB6.0 开发的旧窗口来配置我的控制应用程序。这里我遇到了 2 个问题,
1)以下方法返回 false 并且文本字段未更新。
IntPtr wParam = IntPtr.Zero;
IntPtr lParam = Marshal.StringToHGlobalAuto(text);
bool retVal = Convert.ToBoolean(SendMessage(handle, WM_SETTEXT, wParam, lParam));
有人能帮我弄清楚吗?
2)当我扫描遗留应用程序中的子控制器(使用窗口消息传递)时,我发现一些控制器的类名为ThunderRT6FormDC,ThunderRT6UserControlDC。这些控制器是什么?
I developed an application of controlling other window using WindowsMessage. It works successfully with my sample application, which is build by C#.
However, then I tried to configure my controlling application with the legacy window, which is developed by VB6.0. Here I got 2 issues,
1) The following method returns false and textfield was not updated.
IntPtr wParam = IntPtr.Zero;
IntPtr lParam = Marshal.StringToHGlobalAuto(text);
bool retVal = Convert.ToBoolean(SendMessage(handle, WM_SETTEXT, wParam, lParam));
Can anybody help me to figure it out ?
2) When I scanned the sub-controllers in legacy application (using the window messaging),I found some controllers that their class names are ThunderRT6FormDC, ThunderRT6UserControlDC. What are these controllers ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
2) ThunderRT6FormDC 和 ThunderRT6UserControlDC 是 Visual Basic 特定的类名:VB 源于一个名为 Thunder 的原始项目,因此该名称带有很多 VB 的细节代码。许多 VB 窗口类的名称中都有 Thunder,包括您看到的 2 个。
1)我的期望是您获取的句柄没有指向正确的窗口:您是否使用Spy++或类似的工具来查看VB6窗口并确定正确的文本窗口,或者您之前是否将焦点设置到文本窗口发送 WM_SETTEXT 消息?
2) The ThunderRT6FormDC and ThunderRT6UserControlDC are Visual Basic specific class names: VB sprang from an original project called Thunder and so the name stuck with a lot of the bits and pieces of VB code. Many VB window classes have Thunder in the name, including the 2 you saw.
1) My expectation is that the handle you fetched is not pointing at the right window: are you using Spy++ or a similar tool to look at the VB6 window and determine the proper text window, or are you setting the focus to the text window before sending the WM_SETTEXT message?