360java不兼容_(转)QQ如何不兼容360

这是我在论坛看到:

package aa;

import java.io.BufferedReader;

import java.io.IOException;

import java.io.InputStreamReader;

import javax.swing.JFrame;

import javax.swing.JLabel;

import javax.swing.JOptionPane;

public class BanSupport extends JFrame {

private String keyWord;

private JLabel msg;

public BanSupport(String keyWord) {

super("想禁谁,就可以禁谁");

this.setBounds(200, 200, 500, 200);

this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

msg=new JLabel("所谓监控用户硬盘,只是个笑话.根本就是公开的API。360是SB ");

this.getContentPane().add(msg);

this.keyWord = keyWord.toLowerCase();

this.check();

}

public void check() {

Runtime runtime = Runtime.getRuntime();

Process process = null;

try {

process = runtime.exec("cmd /c Tasklist");

BufferedReader in = new BufferedReader(new InputStreamReader(

process.getInputStream()));

String s = "";

while ((s = in.readLine()) != null) {

s = s.toLowerCase();

if (s.startsWith(keyWord)) {

s = s.substring(0, s.indexOf(".exe") + 4);

JOptionPane.showMessageDialog(this, "您的系统中检测到"+s+",为了保障您的安全,本软件即将退出。请卸载后再使用本检测软件。");

System.exit(-1);

}

}

} catch (IOException e) {

e.printStackTrace();

}

}

}

package aa;

public class Ban360 extends BanSupport {

public Ban360() {

super("360");//这里可以换成QQ

}

public static void main(String[] args) {

Ban360 demo = new Ban360();

demo.setVisible(true);

}

}

但是这个是判断改程序是否运行,而不是qq所说的卸载,但是想法好。

我尝试将process = runtime.exec("cmd /c Tasklist");改为:process = runtime.exec("cmd /c reg query 'HKEY_LOCAL_MACHINE\\SOFTWARE\\360SD'");查询注册表中是否存在360SD来判断,但是读出来的东西却不对,

有尝试了java.util.prefs.Preferences;但是发现只能操作[HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Prefs] 里面的注册表信息,难道要引入其他类库,求高手呵

之前process = runtime.exec("cmd /c reg query 'HKEY_LOCAL_MACHINE\\SOFTWARE\\360SD'");中不用加单引号,代码为:

package aa;

import java.io.BufferedReader;

import java.io.IOException;

import java.io.InputStreamReader;

import javax.swing.JFrame;

import javax.swing.JLabel;

import javax.swing.JOptionPane;

public class BanSupport extends JFrame {

private String keyWord;

private JLabel msg;

public BanSupport(String keyWord) throws IOException {

super("想禁谁,就可以禁谁");

this.setBounds(200, 200, 500, 200);

this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

msg=new JLabel("所谓监控用户硬盘,只是个笑话.根本就是公开的API。360是SB ");

this.getContentPane().add(msg);

this.keyWord = keyWord.toLowerCase();

this.check();

}

public void check() throws IOException {

Runtime runtime = Runtime.getRuntime();

Process process = null;

process = runtime.exec("cmd /c reg query HKEY_LOCAL_MACHINE\\SOFTWARE\\"+keyWord);

BufferedReader in = new BufferedReader(new InputStreamReader(

process.getInputStream()));

while (in.readLine() != null) {

JOptionPane.showMessageDialog(this, "您的系统中检测到"+keyWord+",为了保障您的安全,本软件即将退出。请卸载后再使用本检测软件。");

System.exit(-1);

}

in.close();

process.destroy();

}

}

package aa;

import java.io.IOException;

public class Ban360 extends BanSupport {

public Ban360() throws IOException {

super("aa");//这里可以换成Tencent

}

public static void main(String[] args) throws IOException {

Ban360 demo = new Ban360();

demo.setVisible(true);

}

}

欢迎:feedsky.gif

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值