rinehart(rinehart) 真是高手,请指教一下如何改吧。

解决方案 »

  1.   

    ok!
    没见过的让你们开开眼!
    vbscript修改注册表:http://www.ccw.com.cn/htm/app/aprog/01_3_29_3.asp
    javascript修改注册表:http://www.ccidnet.com/school/web/2001/07/09/70_4616.html
      

  2.   

    Read the Registry
    public class RegistryRead {
     public static void main(String[] args) {
       RegistryRead demo = new RegistryRead();
       demo.doit();
       // IO.PressAnyKey();       
       }
        
     public void doit() {
       displayUserName();
       displayODBCDSN();
       }
        
     public void displayUserName(){
       com.ms.wfc.app.RegistryKey regKey;
       String userName;
       regKey =
         com.ms.wfc.app.Registry.LOCAL_MACHINE.getSubKey
           ("Network\\Logon");
       if (regKey == null) {
         userName = "Unable to get username from Registry!";
         }
       else {
         userName = (String) regKey.getValue("username");
         }
       System.out.println("Username : " + userName);
       } public void displayODBCDSN() {
       com.ms.wfc.app.RegistryKey regKey;
       regKey =
         com.ms.wfc.app.Registry.CURRENT_USER.getSubKey
           ("Software\\ODBC\\ODBC.INI\\ODBC Data Sources");
       if (regKey == null) {
         System.out.println("Unable to get ODBC DSN Registry!");
         }
       else {  
         String dsn [] = regKey.getValueNames();
         System.out.println("ODBC DSN defined : ");
         for(int i = 0;  i < dsn.length; i++) { 
           System.out.println(dsn[i]);
           }
         }
     }
    }
     
      

  3.   

    rinehart(rinehart):
    你所讲的javascript其实只是MS的JScript,而非,Netscape推出的JavaScript,两者在浏览器
    乃至OS层的机理是不同的。
      

  4.   

    只要浏览器支持就可以了!
    本来你如果要修改注册表,就意味着你使用ms的操作系统,有几个使用ms操作系统的人使用
    Netscape?
    所以你使用IE,必然会支持JScript!
      

  5.   

    不过例子比较少,好像大部分使用JavaScript修改注册表的都是病毒!
    ^^
      

  6.   

    好笨!用VC做一个ActiveX控件,用javascript调用ocx,不就可以改了吗?
      

  7.   

    /**
     * @version 1.00 1997-07-01
     * @author Cay Horstmann
     */import java.util.*;public class Win32RegKey
    {  public Win32RegKey(int theRoot, String thePath)
       {  root = theRoot;
          path = thePath;
       }
       public Enumeration names()
       {  return new Win32RegKeyNameEnumeration(root, path);
       }
       public native Object getValue(String name);
       public native void setValue(String name, Object value);   public static final int HKEY_CLASSES_ROOT = 0x80000000;
       public static final int HKEY_CURRENT_USER = 0x80000001;
       public static final int HKEY_LOCAL_MACHINE = 0x80000002;
       public static final int HKEY_USERS = 0x80000003;
       public static final int HKEY_CURRENT_CONFIG = 0x80000005;
       public static final int HKEY_DYN_DATA = 0x80000006;   private int root;
       private String path;   static
       {  System.loadLibrary("Win32RegKey");
       }
    }class Win32RegKeyNameEnumeration implements Enumeration
    {  Win32RegKeyNameEnumeration(int theRoot, String thePath)
       {  root = theRoot;
          path = thePath;
       }   public native Object nextElement();
       public native boolean hasMoreElements();   private int root;
       private String path;
       private int index = -1;
       private int hkey = 0;
       private int maxsize;
       private int count;
    }class Win32RegKeyException extends RuntimeException
    {  public Win32RegKeyException() {}
       public Win32RegKeyException(String why)
       {  super(why);
       }
    }
      

  8.   

    路人甲,感谢你的方法 
    但能否告诉我setValue的用发  谢谢