C# 怎么用WINDOW API
一个外部程序窗体中有两个TLlistViewTListView是放在TPanel中的要怎么过滤掉TPanel直接取到TLlistView中的文本数据呢已知这个外部窗体的句...
一个外部程序窗体中有两个TLlistView TListView是放在TPanel中的
要怎么过滤掉TPanel 直接取到TLlistView中的文本数据呢
已知这个外部窗体的句柄
能给个例子吗 刚接触api 也没找到 C#相关的示例~实在弄不明白 展开
要怎么过滤掉TPanel 直接取到TLlistView中的文本数据呢
已知这个外部窗体的句柄
能给个例子吗 刚接触api 也没找到 C#相关的示例~实在弄不明白 展开
2个回答
展开全部
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;
namespace WindowsApplication3
{
public partial class Form2 : Form
{
public delegate int EnumWindowsCallBack(IntPtr hwnd, IntPtr lParam);
[DllImport("User32.dll")]
public static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
[DllImport("user32")]
public static extern int EnumChildWindows(IntPtr hwndParent, EnumWindowsCallBack lpEnumFunc, int lParam);
[DllImport("user32", EntryPoint = "GetWindowText")]
public static extern int GetWindowTextA(IntPtr hwnd, StringBuilder lpString, int cch);
private EnumWindowsCallBack CallBackProc = null;
public Form2()
{
InitializeComponent();
CallBackProc = new EnumWindowsCallBack(this.EnumProc);
}
private void button2_Click(object sender, EventArgs e)
{
IntPtr hwnd = FindWindow("","");
EnumChildWindows(hwnd, this.CallBackProc, 0);
}
public int EnumProc(IntPtr hWnd, IntPtr lParam) {
StringBuilder title = new StringBuilder(256);
GetWindowTextA(hWnd, title, 256);
this.textBox1.Text += title + "\n";
return 0;
}
}
}
里面的条件你自己写了
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;
namespace WindowsApplication3
{
public partial class Form2 : Form
{
public delegate int EnumWindowsCallBack(IntPtr hwnd, IntPtr lParam);
[DllImport("User32.dll")]
public static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
[DllImport("user32")]
public static extern int EnumChildWindows(IntPtr hwndParent, EnumWindowsCallBack lpEnumFunc, int lParam);
[DllImport("user32", EntryPoint = "GetWindowText")]
public static extern int GetWindowTextA(IntPtr hwnd, StringBuilder lpString, int cch);
private EnumWindowsCallBack CallBackProc = null;
public Form2()
{
InitializeComponent();
CallBackProc = new EnumWindowsCallBack(this.EnumProc);
}
private void button2_Click(object sender, EventArgs e)
{
IntPtr hwnd = FindWindow("","");
EnumChildWindows(hwnd, this.CallBackProc, 0);
}
public int EnumProc(IntPtr hWnd, IntPtr lParam) {
StringBuilder title = new StringBuilder(256);
GetWindowTextA(hWnd, title, 256);
this.textBox1.Text += title + "\n";
return 0;
}
}
}
里面的条件你自己写了
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
DllImport("msvcrt.dll", SetLastError=true)]
static extern IntPtr fopen(String filename, String mode);
给个例子: www.pinvoke.net
static extern IntPtr fopen(String filename, String mode);
给个例子: www.pinvoke.net
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询