How to identify the current display configuration from registry?

I wanted to read the current configuration of display from registry. Suppose, a dual output system is configured with "Extended these displays" settings then i want to know where in registry this information will be stored?
I tried to get the info from 
1. HKEY_LOCAL_MACHINE\HARDWARE\DEVICEMAP\VIDEO which gives only the display devices being registered in the system.
2. HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Video which has multiple guid tags and then multiple subkeys.
3. HKEY_CURRENT_CONFIG\System\CurrentControlSet\Control\VIDEO which has multiple subkeys.
Unable to get the right registry for this case. when multiple displays connected, then i want to know whether it is configured as extended/duplicate. 
Please guide me if it is possible.

There is no direct way for getting the monitor count. we need to code for each graphic card separately. 
i found a way like below, for those of you interested in getting the exact monitor count:
int ComputerInfo::GetRegistryValue( CSString regPath, CSString valueName, int cntIndex )
int monCount = 0;
BYTE pBuffer[1024];
DWORD nMaxLength;
CSString szSubKey = regPath;
szSubKey = szSubKey.substr(18);
CSString szValueName = valueName;
DWORD rc;
DWORD dwType;
HKEY hOpenedKey;
LOG_INFO ( "Registry key " << szSubKey << "\\" << szValueName );
if( ERROR_SUCCESS == RegOpenKeyEx (
HKEY_LOCAL_MACHINE, // handle of open key
szSubKey, // address of name of subkey to open
0, // reserved
KEY_READ, // security access mask
&hOpenedKey // address of handle of open key
rc = RegQueryValueEx(
hOpenedKey,
(const char*)szValueName,
0,
&dwType,
(LPBYTE)pBuffer,
&nMaxLength );
if( rc != ERROR_SUCCESS )
LOG_INFO ( "Registry key " << valueName << " not found." );
monCount = 0;
else
LOG_INFO ( "Monitor Count: " << CSString(pBuffer[cntIndex]) );
monCount = pBuffer[cntIndex];
RegCloseKey( hOpenedKey );
else
monCount = 0;
return monCount;
int ComputerInfo::GetMonitorCount()
int fResult;
fResult = GetSystemMetrics(SM_CMONITORS);
LOG_INFO( "Video Output Count from System: " << fResult );
if ( fResult == 1 )
// I need to get the address of a few multi-monitor functions
HMODULE user32 = GetModuleHandle ("User32.DLL");
typedef BOOL WINAPI tEnumDisplayDevices (void*, DWORD, DISPLAY_DEVICE*, DWORD);
tEnumDisplayDevices* fEnumDisplayDevices = (tEnumDisplayDevices*) GetProcAddress (user32, "EnumDisplayDevicesA");
if (fEnumDisplayDevices == NULL) return false;
// count the number of monitors attached to the system
DISPLAY_DEVICE dd; dd.cb = sizeof(dd);
for (DWORD dev=0; fEnumDisplayDevices (NULL, dev, &dd, 0); ++dev)
LOG_INFO ("Device: " << dd.cb << ", " << dd.DeviceID << ", " << dd.DeviceKey << ", " << dd.DeviceName << ", " << dd.DeviceString << ", " << dd.StateFlags );
CSString devName = dd.DeviceName;
DISPLAY_DEVICE dd1; dd1.cb = sizeof(dd1);
// after second call DispDev.DeviceString contains monitor's name
EnumDisplayDevices(devName, 0, &dd1, 0);
LOG_INFO ("Device: " << dd1.cb << ", " << dd1.DeviceID << ", " << dd1.DeviceKey << ", " << dd1.DeviceName << ", " << dd1.DeviceString << ", " << dd1.StateFlags );
if (dd.StateFlags & DISPLAY_DEVICE_MIRRORING_DRIVER)
LOG_INFO ("Device: " << dd.DeviceName << " is a mirroring driver device. " );
continue;
if (dd.StateFlags & DISPLAY_DEVICE_ATTACHED_TO_DESKTOP)
LOG_INFO ("Device: " << dd.DeviceName << " is attached to the desktop. " );
if ( StringUtils::StartsWith( dd.DeviceString, "Matrox", false ) )
return GetRegistryValue(dd.DeviceKey, "ContextItem.Config", 40);
else if ( StringUtils::StartsWith( dd.DeviceString, "NVIDIA", false ) )
if ( !StringUtils::StartsWith( dd.DeviceString, "NVIDIA ION", false ) )
return GetRegistryValue(dd.DeviceKey, "NV_TargetData", 0);
else
return GetSystemMetrics(SM_CMONITORS);
else if ( StringUtils::StartsWith( dd.DeviceString, "Intel", false ) )
return GetRegistryValue(dd.DeviceKey, "CurrentState", 0);
else
return GetSystemMetrics(SM_CMONITORS);
else
LOG_INFO ("Device: " << dd.DeviceName << " is not attached. " );
LOG_INFO ( "No Devices found." );
return 0;
else
LOG_INFO( "Considered Video Output Count from System. " << fResult );
return fResult;

Similar Messages

  • How to identify the current displaying card in CardLayout

    hi all,
    i have a CardLayout() containing some "cards" that are JPanels...i know i could "flip through" the "cards" by using those previous(), next(), etc...but how do i get the "name" of the card the is currently showing...
    i guess i need a function that is the reverse of show(Container parent, String name)...this show() gets the parent and the "name" of the card as parameters and show the card out...what i want to do is...to get the "name" of the card that is currently shown...
    any ideas?
    thank you very much!

    This is just a shot in the dark, but you could write a method that goes through the JPanels that are in the CardLayout calling the JPanel.isShowing() method. This may tell you whether or not the JPanel is visible. You could then link it back to the name with a corresponding string array.
    Just a thought.
    Good luck!
    Cardwell

  • How to determine the Current Domain name from inside an Mbean / Java Prog

    We have registered an Application Defined MBean. The mbean has several APIs. Now we want to determine the currrent domain using some java api inside this Mbean. Similarly we have deployed a Webapp/Service in the Weblogic domain. And inside this app we need to know the current Domain. Is there any java api that will give this runtime information.
    Note: We are the MBean providers not clients who can connect to the WLS (using user/passwd) and get the domain MBean and determine the domain.
    Fusion Applcore

    Not sure if this will address exactly what you are looking to do, but I use this technique all the time to access runtime JMX information from within a Weblogic deployed application without having to pass authentication credentials. You are limited, however, to what you can access via the RuntimeServiceMBean. The example class below shows how to retrieve the domain name and managed server name from within a Weblogic deployed application (System.out calls only included for simplicity in this example):
    package com.yourcompany.jmx;
    import javax.management.MBeanServer;
    import javax.management.ObjectName;
    import javax.naming.InitialContext;
    public class JMXWrapper {
        private static JMXWrapper instance = new JMXWrapper();
        private String domainName;
        private String managedServerName;
        private JMXWrapper() {
        public static JMXWrapper getInstance() {
            return instance;
        public String getDomainName() {
            if (domainName == null) {
                try {
                    MBeanServer server = getMBeanServer();
                    ObjectName domainMBean = (ObjectName) server.getAttribute(getRuntimeService(), "DomainConfiguration");
                    domainName = (String) server.getAttribute(domainMBean, "Name");
                } catch (Exception ex) {
                    System.out.println("Caught Exception: " + ex);
                    ex.printStackTrace();
            return domainName;
        public String getManagedServerName() {
            if (managedServerName == null) {
                try {
                    managedServerName = (String) getMBeanServer().getAttribute(getRuntimeService(), "ServerName");
                } catch (Exception ex) {
                    System.out.println("Caught Exception: " + ex);
                    ex.printStackTrace();
            return managedServerName;
        private MBeanServer getMBeanServer() {
            MBeanServer retval = null;
            InitialContext ctx = null;
            try {
                //fetch the RuntimeServerMBean using the
                //MBeanServer interface
                ctx = new InitialContext();
                retval = (MBeanServer) ctx.lookup("java:comp/env/jmx/runtime");
            } catch (Exception ex) {
                System.out.println("Caught Exception: " + ex);
                ex.printStackTrace();
            } finally {
                if (ctx != null) {
                    try {
                        ctx.close();
                    } catch (Exception dontCare) {
            return retval;
        private ObjectName getRuntimeService() {
            ObjectName retval = null;
            try {
                retval = new ObjectName("com.bea:Name=RuntimeService,Type=weblogic.management.mbeanservers.runtime.RuntimeServiceMBean");
            } catch (Exception ex) {
                System.out.println("Caught Exception: " + ex);
                ex.printStackTrace();
            return retval;
    }I then created a simply test JSP to call the JMXWrapper singleton and display retrieved values:
    <%@page contentType="text/html" pageEncoding="UTF-8"%>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
       "http://www.w3.org/TR/html4/loose.dtd">
    <%@ page import="com.yourcompany.jmx.JMXWrapper"%>
    <%
       JMXWrapper jmx = JMXWrapper.getInstance();
       String domainName = jmx.getDomainName();
       String managedServerName = jmx.getManagedServerName();
    %>
    <html>
        <head>
            <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
            <title>JMX Wrapper Test</title>
        </head>
        <body>
            <h2>Domain Name: <%= domainName %></h2>
            <h2>Managed Server Name: <%= managedServerName %></h2>
        </body>
    </html>

  • How to identify the current lead selection is child or parent in rec node

    Hi
    I am using a recursive node to populate a table with TreeByNestingTableColumn as master column. Now my problem is how do I identify if the current selected row in the table is a child or parent? When I get the lead selection value, I find that its the same for the parent and the child. I am setting the isLeaf and hasChildren boolean properties appropriately as false and true for parent and true and false for child. But since the lead selection is returning the same the below rsTableElement always gives me the parent, I always get those parameter values as that of parent. I am writing this inside the onleadSelect event of the table.
    IRsTableElement rsTableElement = (IRsTableElement) wdContext.nodeRsTable().getElementAt(wdContext.nodeRsTable().getLeadSelection());
    In this scenario how do I know if the current selection is made on a child?
    Appreciate for all help and any code snippets.
    Thanks,
    KN.

    Hi KN,
    I guess you want to check if the node that you selected is parent or child.. This can be achieved by using getTreeSelection() method of IWDNode.
    If you write following code in your lead selection action, you can determine the if it is a parent or child node.
    wdComponentAPI.getMessageManager().reportSuccess(wdContext.nodeRsTable().getTreeSelection() +"");
    the output will be something like
    <ViewName>.RsTable.0.ChildRsTable.1.ChildRsTable.0.. depending upon which node you have selected.
    That way you can find out if it is a parent or child node.
    Abhinav

  • How to identify the type of transaction from hr_api_transactions?

    Hi,
    I want to identify type of transaction from HR_API_TRANSACTIONS.
    I want to find a particular transaction is of CREATE/ UPDATE or DELETE transaction.
    I have checked values of different columns.
    However, I am not able to differentiate between transactions.
    Any pointers on this!!
    Thanks!!
    Best Regards,
    Narender

    I have found that in R12, the table HR_API_TRANSACTION_VALUES is not holding the desired values.
    Instead of this table, we have information in the transaction_document column of HR_API_TRANSACTIONS.
    And we can read this column to identify the type of transaction.
    Thanks!!
    Best Regards,
    Narender

  • How to identify the Exploded EAR name from the UI

    Hi,
    I need to do a customization in a page, "Manage Employment" (of 'Human Resources' product family)using Jdeveloper. Is there a way to find the corresponding EAR file from the UI.
    When I searched in the UNIX box (under /xx/oracle/fapp/products/fusionapps/applications/hcm/deploy) I can see Ext*.jar file in the following EAR directories.
    [ora@xxxxxxxxx deploy]$ find . -name Ext*.jar
    ./EarHcmCore.ear/APP-INF/lib/ExtHcmCustomization.jar
    ./EarHcmCoreExternal.ear/APP-INF/lib/ExtHcmCustomization.jar
    ./EarHcmTalent.ear/APP-INF/lib/ExtHcmCustomization.jar
    ./EarHcmCompensation.ear/APP-INF/lib/ExtHcmCustomization.jar
    ./EarHcmPayroll.ear/APP-INF/lib/ExtHcmCustomization.jar
    ./EarHcmBenefits.ear/APP-INF/lib/ExtHcmCustomization.jar
    ./EarHcmCoreSetup.ear/APP-INF/lib/ExtHcmCustomization.jar
    Which JAR file should I take to customize? Is the file same under different exploded EAR directories. Please let me know.
    Thanks,

    Hi Jani,
    I moved the entire EAR directory and the Ext*.jar to my local machine and created the "Customization Application Workspace". I was able to find out the View object to be customized
    using the Filter of 'Customizable Archive' as you suggested.
    But when I try to edit the page, the Jdeveloper seems to be hanged and I get the following error in the log.
    Apr 23, 2013 12:35:52 AM oracle.javatools.buffer.ReadWriteLock traceDeadlock
    SEVERE: lock deadlock; thread 'AWT-EventQueue-0' blocked on lock 'BenefitsServic
    eCenter.jsff' for more than 20,000ms:
    "AWT-EventQueue-0" id=15, blocked, no reads, no writes, no history collected:
    at oracle.javatools.buffer.ReadWriteLock.writeLock(ReadWriteLock.java:34
    6)
    at oracle.javatools.buffer.AbstractTextBuffer.writeLock(AbstractTextBuff
    er.java:1045)
    at oracle.ide.model.TextNode$FacadeTextBuffer.writeLock(TextNode.java:13
    88)
    at oracle.mds.internal.dt.dom.MDSDomModelPlugin.acquireWriteLockDirectly
    (MDSDomModelPlugin.java:1350)
    at oracle.bali.xml.dom.impl.DomModelImpl._acquireWriteLock(DomModelImpl.
    java:1632)
    at oracle.bali.xml.dom.impl.DomModelImpl.acquireWriteLock(DomModelImpl.j
    ava:486)
    I use the below memory setting in the Jdev start command script.
    set USER_MEM_ARGS=-Xms256m -Xmx1250m -XX:MaxPermSize=1024m -XX:CompileThreshold=8000
    Also I have done the appropriate memory settings in jdev.conf and ide.conf files as suggested in the Fusion Applications Developer guide.
    Can you please help?
    Thanks,

  • How to modify the current editor contents from a JDev extension

    Hi there,
    I am creating an extension for JDev 11.1.1.3.0 and I am stuck... To simply things, let's say that I want to create an extension that converts the selected text in a editor to UPPERCASE.
    So far, I was able to get the selected text using *((CodeEditor)getContext().getView()).getSelectedText()* inside the doit() method.
    However I don't know how to update the text in the editor... I am pretty sure that it is more complicated than simply calling a setText() method but I could not find any documentation or examples in the web. Any tips?
    Thanks
    Luis

    Hi Luis,
    u can change the selected Text by the below command...
    *((CodeEditor)getContext().getView()).replaceSelection(text.toUpperCase());*
    And also u can find some samples and docimentation in the below link
    http://www.oracle.com/technetwork/developer-tools/jdev/downloads/index-091862.html
    Regards,
    Suganth.G

  • How to Identify the current step in execution

    Hi,
    My merge query takes a long time to run. I monitored the session and it was doing a full table scan and it registered as a long-operation. Now thats finished and it goes off to do whatever else it needs to do.
    How do I know whats its executing at any given point in time? I want to know what it scans / writes next and what object its scanning. In other words, I want to know which step of the execution plan is it currently executing.
    Is there a way of identifying this? Any V$ views which provide this information?
    Thanks in advance,
    K

    Will tracing the session tell me where it is
    currently?Tracing the session generates a file on disk with all the various waits in it. Generally, you would analyze that trace file at the end of the process to see where the time was spent. In theory, I suppose that it may be possible to watch that trace file and deduce what step the query was on. It's far from obvious to me, though, that this would be particularly practical-- the trace file grows pretty quickly and isn't particularly trivial to read, particularly in real time.
    Justin

  • How to get the current process Id from a java program

    Can we fetch the process id froma a program as we do it in c++ as getCurrentProcessId()

    why not to launch a process like ("rundll.exe _params_") and get its output data
    sorry, i'm not in WinAPI to continue with params, but you should know i think or consult somebody.
    or there is special java package, which can call windows functions. you can find it in Microsoft Java SDK.

  • How to identify the alternative payee in payment run

    Hi All
    How to identify the alternative payee details in payment run by using transaction code F110 or which table or fields contain the alternative payee details for example REGHU & REGUP.
    How to identify the alternative payee details from system level. Any Update.
    Regards
    K.Gunasekar.

    Hi,
    EMPFG (Payment Recipient ) field in REGUH will give you the alternate Payee name of the Payment run executed in F110.
    Regards,
    SAPFICO

  • How to get the current logged in username from windows and put it into an AS var

    Hello,
    I was hopeing someone would know how to get the current logged in username from windows and put it into a var, so I can create a dynamic text box to display it.
    Thanks in advance
    Michael

    Just for everyone’s info, this is the script I have used to get the logged in windows username into flash ---- not and air app.
    In the html page that publishes with the .swf file under the <head> section:-
    <script language="JavaScript" type="text/javascript">
    function findUserName() {
         var wshell=new ActiveXObject ("wscript.shell");
         var username=wshell.ExpandEnvironmentStrings("%username%");
         return username;
    </script>
    The ActionScript:-
    import flash.external.ExternalInterface;
    var username:String = ExternalInterface.call ("findUserName");
    trace (username); // a quick test to see it in output

  • How to get the current week from sysdate?

    Hi sir,
    i want to know how to get the current week from sysdate?
    thanks

    Hi Nicolas
    It seems you like to check my post and also make commend ;) thanks for your attention
    Have you ever read the posts above and given solutions ?Yes, I did
    Have you read the docs ? Yes, I checked
    What's the added value here ?Did youYou shared doc with solution(long one), I shared short one which point same solution(Check what Joel posted)..So what is benefit, As you can guess oracle docs are sometimes become so complicated as specialy for beginner...(At least it was like that for me and Belive me somedocs are still sooo complicated even for oracle coworkers ) But for you I dont know ;)
    => Why writting the PS in bold ?Why.. Let me think... Ohh Maybe I am looking some questions(many) and even user get answer they should not changed status so I am reading some posts and try to get problem and loosing time..
    So I am putting that PS wiht BOLD because I dont wanna lose time my friend ;) Because While I am trying to help ppl here In same time I am trying to giving support to my customer prod systems. Which mean time is very important for me...
    Hope my answer could satisfy you..
    One important PS for you.. You may not like my posts (or someone) but my friend I become tired to read&answer and make commend to on your comment which is about my posts.
    I am not newbie in forum(At least I fell like that) and I belive I know how I should make post..
    Thank you
    Regards
    Helios

  • ICS 2.x: How do I change the hour display format from AM/PM to 24 hour mode in the JavaScript?

    How do I change the hour display format from the AM/PM mode to the 24 hour mode
    in the JavaScript?
    <P>
    To change the hour display format,<BR>
    <P>
    <OL>
    <LI>Open the <I>loadpoint</I>/CalendarServer/cal/uicust/en/main.html
    file.
    <P>
    <LI>Go to the "Misc." section.
    <P>
    <LI>Edit the following line:<BR>
    <P>
    i18n['def clock'] = '24';
    </OL>

    laugh
    how analog. 
    neat idea, but i need to see that part of the screen after login on a fairly regular basis, otherwise i might seriously do this.

  • How to keep the current http session after returning from external web site

    Hi,
    When I use the response.sendRedirect api to redirect the web page to the external payment site, after payment and return back to the current application, I found that the current http session is lost.
    How to keep the current http session after returning from external web site?
    Thanks

    You should make your sidebar1 and sidebar2 fixed positioned. Make your content DIV fluid.
    This should help you: http://www.glish.com/css/7.asp

  • How to get the current page URL

    HI All
    I am working in oracle apps 4.0
    I have one page called history in that i have one page item called Application url. My application id is 122 but its a copy of application 106
    How to get the current page url for the page item.
    Any steps should be help ful
    Thanks & Regards
    Srikkanth.M

    I'm not 100% clear on what the requirement is from the description, however it does sound like you are making things unnecessarily complicated.
    If you want permanent/ID-independent links then use application and page aliases.
    so here we used to display the url like this: <tt>{noformat}http://81.131.254.171:8080/apex/f?p=122{noformat}</tt>
    Do you mean that the URL is displayed like that? If so that doesn't seem particularly helpful. How is anyone supposed to know what it is?
    There are many ways to provide links in APEX&mdash;including lists and nav bars.
    Where the link is to another resource located on the same server (such as another page in the same app, or a different app in the workspace), relative addressing can be used, making it unecessary to include scheme, domain and port information in the URL. For example, if the page to be linked to has a page alias <tt>ABOUT</tt> in an application with alias <tt>UNITY</tt>, and the apps share an authentication scheme/cookie to permit shared sessions, then the link URL is simply
    f?p=UNITY:ABOUT:&APP_SESSION.

Maybe you are looking for