使用Win32::GuiTest从网格显示控件获取数据(AfxWnd42s)
我目前正在编写一些 Perl 脚本来测试我们的 GUI 应用程序之一。我使用 perl 的 Win32::GuiTest 作为基础,它的大部分功能都非常实用。然而,我现在被困在试图从网格控件中获取数据(不确定小部件的实际名称是什么,因为这应该是黑盒测试)。使用 WinSpy++,我可以看到它的类是“AfxWnd42s”,无论这意味着什么。我可以使用以下代码获取窗口句柄:
#
# check that listed ports match the spec for this model
#
my @portgrids = FindWindowLike($win,undef,"AfxWnd42s");
if(not @portgrids){ die "can't find port grid"; }
for(@portgrids){
my $styles = GetWindowLong($_,Win32::GuiTest::GWL_STYLE());
my $text = WMGetText($_);
$wintext = GetWindowText($_);
printf("static w=%x, s=$wintext, style=%x text=<<$text>>\n",$_,$styles);
}
text 和 wintext 都不包含任何值,即使网格控件中有数据。我已经尝试了 GetWindowLong 的许多不同选项,但似乎没有返回有关网格内容的任何内容。另外,我正在扫描的窗口没有子窗口。我被困住了。
不幸的是,我无法访问代码或开发环境来构建应用程序。我只能按照 WinSpy++ 告诉我的有关窗口组件的信息。
I'm currently writing some perl scripts to test one of our GUI applications. I'm using perl's Win32::GuiTest as a foundation, and it's pretty functional for the most part. However, I am now stuck trying to get data out of a grid control (not sure what the actual name of the widget is since this is supposed to be black-box testing). Using WinSpy++, I can see that it's class is "AfxWnd42s", whatever that means. I can get the window handle with this code:
#
# check that listed ports match the spec for this model
#
my @portgrids = FindWindowLike($win,undef,"AfxWnd42s");
if(not @portgrids){ die "can't find port grid"; }
for(@portgrids){
my $styles = GetWindowLong($_,Win32::GuiTest::GWL_STYLE());
my $text = WMGetText($_);
$wintext = GetWindowText($_);
printf("static w=%x, s=$wintext, style=%x text=<<$text>>\n",$_,$styles);
}
Neither text, nor wintext contain any value, even though there is data in the grid control. I've tried a number of different options to GetWindowLong, but nothing seems to return anything about the contents of the grid. Also, The windows I'm scanning have no children. I'm stuck.
Unfortunately I don't have access to the code or the dev environment to build the application. I can only go by what WinSpy++ tells me about the window components.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论