C# 怎么通过sendMessage操作下拉列表框,求助很久了,帮帮忙吧。真的急用
希望能学到获取下拉框里数量选择指定的内容,
获取指定内容。
有个参考,但是好像他没实现
http://topic.csdn.net/u/20120818/00/a277b7f0-5318-4560-8732-eaa9e9323b50.html?r=79446459
希望大家帮忙解决一下,尤其是那些常量,希望也写出声明,
我不知道值是什么,没办法测试。
谢谢了,真的很有用 --------------------编程问答-------------------- 高端,帮顶 --------------------编程问答-------------------- 怎么就没人会呢 --------------------编程问答-------------------- 你写的不清楚。别人看不明白。所以不知道怎么回。 --------------------编程问答-------------------- 对,不知道你说的是listbox还是combobox,这两个命令是不同的。
按照combobox回答一下
--------------------编程问答-------------------- --------------------编程问答-------------------- 楼主实现 了吗? 如果 实现 的话 分享一下谢谢 --------------------编程问答--------------------
const int CB_GETCOUNT = 0x0146;
const int CB_GETLBTEXT = 0x0148;
const int CB_SETCURSEL = 0x014e;
[DllImport("user32.dll")]
static extern int SendMessage(IntPtr hwnd, int msg, int wParam, int lParam);
//获得选项数量
int count = SendMessage(comboBox1.Handle, CB_GETCOUNT, 0, 0);
//获得指定索引的选项内容,索引index
byte[] b = new byte[10];
fixed (byte* p = b)
{
SendMessage(comboBox1.Handle, CB_GETLBTEXT, index, (int)p);
}
string s = Encoding.Unicode.GetString(b);
//选择指定索引的选项,索引index
SendMessage(comboBox1.Handle, CB_SETCURSEL, index, 0);
上面 的那个 P是 什么 啊,高手 --------------------编程问答--------------------
指针!明确的告诉大家,C#是有指针的!!
补充:.NET技术 , C#