Solved

How to write a byte value to registry using java

Posted on 2013-01-21
7
483 Views
Last Modified: 2013-01-28
Hi all.
I need to write a byte value to registry using java.


I use this code in vb.net.

 Dim RegKey As Microsoft.Win32.RegistryKey =Microsoft.Win32.Registry.CurrentUser.CreateSubKey("Software\Microsoft\Internet Explorer\Main")
Dim IEDispBinarySetting As Byte() = {&H2C, 0, 0, 0, 2, 0, 0, 0, _
                                                3, 0, 0, 0, &HFF, &HFF, &HFF, &HFF, _
                                                &HFF, &HFF, &HFF, &HFF, &HFF, &HFF, &HFF, &HFF, _
                                                &HFF, &HFF, &HFF, &HFF, 0, 0, 0, 0, _
                                                &H1E, 0, 0, 0, &H1D, 3, 0, 0, _
                                                &HDE, 2, 0, 0}

 RegKey.SetValue("Window_Placement", IEDispBinarySetting)




How do I  set a byte value to windows registry using java??
give me code!
0
Comment
Question by:HFunakawa
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 30

Accepted Solution

by:
IanTh earned 167 total points
ID: 38804156
0
 
LVL 16

Assisted Solution

by:Valeri
Valeri earned 167 total points
ID: 38804307
0
 
LVL 86

Assisted Solution

by:CEHJ
CEHJ earned 166 total points
ID: 38805170
Let us know how you get on with those and we can look into the binary write
0
MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

 
LVL 16

Expert Comment

by:Valeri
ID: 38805194
you have to use putByteArray to achieve the same
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 38805201
The first thing you need to do is to ensure that you can get to the right key. The Preferences api is very restricted in that respect
0
 

Author Comment

by:HFunakawa
ID: 38825388
thank you for everyone and sorry for late.


i made a program from those sample.
like this

 private static byte[] toCstr(String str) {
                byte[] result = new byte[str.length() + 1];

                for (int i = 0; i < str.length(); i++) {
                  result = (byte) str.charAt(i);
                }
                result[str.length()] = 0;
                return result;
              }


      byte[] a=toCstr("&H2C, 0, 0, 0, 2, 0, 0, 0, 3, 0, 0, 0, &HFF, &HFF, &HFF, &HFF, &HFF, &HFF, &HFF, &HFF, &HFF, &HFF, &HFF, &HFF, &HFF, &HFF, &HFF, &HFF, 0, 0, 0, 0, &H1E, 0, 0, 0, &H1D, 3, 0, 0, &HDE, 2, 0, 0");
    Advapi32Util.registrySetBinaryValue(WinReg.HKEY_CURRENT_USER, "Software\\Microsoft\\Internet Explorer\\Main", "Window_Placement", a);


im not so sure its right..
anyway it worked so thanks for all your help.



0
 
LVL 86

Expert Comment

by:CEHJ
ID: 38828130
im not so sure its right..
It isn't ;) You need something different to get the right array, so if that's an issue, please open a new question
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
login form jsp example 2 68
How to configure empty element in XML Document parser? 15 57
glassfish admin console 1 45
JDBC performance 8 33
Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.
Suggested Courses

738 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question