?
Solved

Access the Display Properties Panel in Windows

Posted on 2006-11-08
5
Medium Priority
?
389 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 1200 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

Get real performance insights from real users

Key features:
- Total Pages Views and Load times
- Top Pages Viewed and Load Times
- Real Time Site Page Build Performance
- Users’ Browser and Platform Performance
- Geographic User Breakdown
- And more

Question has a verified solution.

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

This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
In this post we will learn different types of Android Layout and some basics of an Android App.
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.
This video teaches viewers about errors in exception handling.
Suggested Courses
Course of the Month9 days, 21 hours left to enroll

762 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