How can I retrieve the values from window of class “ThunderRT6ListBox” using user32.dll in c#

对着背影说爱祢 提交于 2019-12-07 02:24:26

You're dealing with a VB6 application from eons ago. "Thunder" was the internal name for the VB product/project (trivial side note).

You're closer than you realize. If you have the HWND to the control, and I think you do:

  1. Call SendMessage with that HWND and the message LB_GETCOUNT to get the number of items in the list.
  2. For each index, call SendMessage with LB_GETTEXTLEN and the current item index to get the length of the text, then allocate a buffer accordingly.
  3. Call SendMessage again, this time using LB_GETTEXT message, same item index (zero-based), and the reference to your buffer, and that should get you each item's text.

You might consider one more declaration/alias to SendMessage that just returns an int, which should make some of these calls simpler.

If I get a chance, I will clean this up a bit later with a more specific code example (or at least pseudocode), but I get the impression you're very much on the right track already and may only need this basic description to get the rest of the way.

Good luck!

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!