Solved

Access the Display Properties Panel in Windows

Posted on 2006-11-08
5
388 Views
Last Modified: 2012-05-05
Hey Experts,

Any way to access the Display Properties panel in Windows and change settings.
Maybe I need a do this in C++/MFC's and write a JNIWrapper for this allowing me to access using Java?

I can make the Panel appear using the following command in a .bat file and forcing that to run:
Rundll32.exe shell32.dll,Control_RunDLL Desk.cpl,@0, 3

Any ideas??
Cuchulan
0
Comment
Question by:Cuchulan
[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
  • 3
  • 2
5 Comments
 
LVL 6

Accepted Solution

by:
superm401 earned 300 total points
ID: 17944578
You can execute that command with the below code.  However, whether this kind of solution will suffice depends on your application.  So...what specific settings do you really need to access and/or change?


import java.io.IOException;

public class RuntimeHacking
{
      public static void main(String[] args)
      {
            Runtime myRuntime = Runtime.getRuntime();
            try
            {
                  myRuntime.exec("Rundll32.exe shell32.dll,Control_RunDLL Desk.cpl,@0, 3");
            }
            catch(IOException e)
            {
                  System.err.println("Command execution failed.");
                  System.exit(1);
            }
      }
}
0
 

Author Comment

by:Cuchulan
ID: 17996347
Hi superm401,

Cheers that worked for me.

The settings I need to change are to set "Use this device as the primary monitor" and "Extend my Windows Desktop onto this monitor"

If its possible for these to be changes that would be brillant.

Cheers!
0
 
LVL 6

Expert Comment

by:superm401
ID: 17996867
I found some API documentation (http://msdn2.microsoft.com/en-gb/library/ms533235.aspx) that allows you to change the primary monitor.  I can't figure out how you would change the "extend my windows Desktop".  I think the primary monitor part could probably be handled by making a quick C application to use the API functions, then calling it with Runtime.exec, since no parameters need be passed and a JNI isn't really more elegant.
0
 

Author Comment

by:Cuchulan
ID: 17997588
Will try that out.

Thanks for all your help superm401!

Cheers!

0
 
LVL 6

Expert Comment

by:superm401
ID: 18015813
You're welcome.  Best of luck.
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
The viewer will learn how to implement Singleton Design Pattern in Java.

707 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