目前只可以发文字,不知道如何发粘贴板? private bool SendQQMsg(IntPtr hWnd, string qqcaption, string sendtext)
{
try
{
NativeMethods.ShowWindow(hWnd, NativeMethods.ShowWindowCommands.Normal);
NativeMethods.BringWindowToTop(hWnd);
SendKeys.SendWait(sendtext);
SendKeys.SendWait("{ENTER}");
return true;
}
catch
{
return false;
}
}怎么改造
SendKeys.SendWait("^c");
一般是 ctrl+a 全选再 ctrl+c。
Ctrl+alt截图Ctrl+v粘贴
IDataObject iData = Clipboard.GetDataObject();
//检测数据是否是可以使用的格式,即文本格式
if (iData.GetDataPresent(DataFormats.Text))
{
string sendtext = (String)iData.GetData(DataFormats.Text);
SendKeys.SendWait(sendtext);
}