在某些计算机上忽略CB_SELECTSTRING [英] CB_SELECTSTRING ignored on some machines

查看:409
本文介绍了在某些计算机上忽略CB_SELECTSTRING的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用user32库自动化一些浏览器的点击在Windows,IE - 特别是保存为对话框。我的解决方案工作正常在我的盒子,但在其他计算机上不是真的。

I am using user32 library to automate some out of browser clicks on Windows, IE - "save as" dialog in particular. My solution works fine on my box however on other computers not really.

问题是当我在组合框中设置下载路径时,我传递的文件名被忽略,并使用原始值。其他消息在两种环境下都被接受,包括点击按钮,获取窗口的句柄,迭代窗口,你命名。

The problem is when I am setting download path in a combobox, the file name I am passing in is just ignored and the original value is used. Other messages are accepted just fine on both environment, this includes clicking buttons, getting handles to windows, iterating windows, you name it.

我知道这是一个相当广泛的问题,但任何想法可能会影响这种行为?我相信我的代码是正确的,所以我在其他地方搜索原因,如权限,不同的user32版本... ...

I know it is quite broad question, but any idea what could influence such behaviour ? I believe my code is correct, so I am searching the cause elsewhere, like permissions, different user32 versions, ... ??

以下将显示组合框中的文本,选择字符串将成功,但一旦保存按钮被点击,使用原始值。

Following will display the text in the combobox, select string will succeed, but once the save button is clicked, original value is used.

 User32.SendMessage(combobox, User32Constants.CB_ADDSTRING, 0, DownloadAsFileName);
 var selected = User32.SendMessage(pointerToParent, User32Constants.CB_SELECTSTRING, -1, DownloadAsFileName);

我尝试了不同的获取目标路径到组合框中的技术,但是结果相同。只在我的盒子,我可以看到,然后sendmessages返回预期的结果,但使用默认值代替。

I tried different techniques of getting the destination path into the combobox, however same results. Works on my box only, I can see then sendmessages are returning expected results, but the default value is used instead.

User32.SendMessage(editPartOfCB, User32Constants.WM_SETTEXT, DownloadAsFileName.Length, DownloadAsFileName);
User32.SendMessage(combobox, User32Constants.CB_SETCURSEL, 0, IntPtr.Zero);

任何帮助谢谢!

推荐答案

根据您用于更改文件名的方法,向ComboBox的父级(CBN_SELCHANGE或CBN_EDITCHANGE)发送适当的WM_COMMAND通知

Depending on the method you use for changing the file name, send an appropriate WM_COMMAND notification to the parent of the ComboBox (CBN_SELCHANGE or CBN_EDITCHANGE)

这篇关于在某些计算机上忽略CB_SELECTSTRING的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆