java控制电脑给对方微信发消息
1.打开微信窗口 public void openWeChat() {//判断当前系统释放支持Desktop提供的接口
if (Desktop.isDesktopSupported()) {
try {
//打开微信窗口
desktop.open(new File("C:\\Program Files (x86)\\Tencent\\WeChat\\WeChat.exe"));
} catch (IOException e) {
e.printStackTrace();
}
}
}
2.选择好友
public void ChooseFriends(String name) {
Transferable text = new StringSelection(name);
clip.setContents(text, null);
bot.delay(1000);
bot.keyPress(KeyEvent.VK_CONTROL);
bot.keyPress(KeyEvent.VK_F);
bot.keyRelease(KeyEvent.VK_CONTROL);
bot.delay(1000);
bot.keyPress(KeyEvent.VK_CONTROL);
bot.keyPress(KeyEvent.VK_V);
bot.keyRelease(KeyEvent.VK_CONTROL);
bot.delay(2000);
bot.keyPress(KeyEvent.VK_ENTER);
}
3.发消息
public void SendMessage(String message) {
Transferable text = new StringSelection(message);
clip.setContents(text, null);
bot.delay(1000);
bot.keyPress(KeyEvent.VK_CONTROL);
bot.keyPress(KeyEvent.VK_V);
bot.keyRelease(KeyEvent.VK_CONTROL);
bot.delay(1000);
bot.keyPress(KeyEvent.VK_ENTER);
bot.delay(1000);
bot.keyPress(KeyEvent.VK_CONTROL);
bot.keyPress(KeyEvent.VK_ALT);
bot.keyPress(KeyEvent.VK_W);
bot.keyRelease(KeyEvent.VK_CONTROL);
bot.keyRelease(KeyEvent.VK_ALT);
} 😂😂😂瞎搞, 大可不必呀随便找个微信的dll就行啊 哈哈哈哈 还需要这样吗 ma15803216102 发表于 2023-5-8 14:09
大可不必呀随便找个微信的dll就行啊
大佬分享一下可否? 我觉的挺好
页:
[1]