Topic Title: Ability to log mounted displays in Catalyst
Topic Summary:
Created On: 07/22/2014 07:08 PM
Status: Post and Reply
Linear : Threading : Single : Branch
Search Topic Search Topic
Topic Tools Topic Tools
View similar topics View similar topics
View topic in raw text format. Print this topic.
 07/22/2014 07:08 PM
User is offline View Users Profile Print this message

Author Icon
Eyesonjune
Peon

Posts: 2
Joined: 07/22/2014

This is an odd request, but I'm trying to figure out a way to log how many displays are mounted at one time. 

 

For example, client is running two outputs on video card which is VGA and HDMI. They have a DJ come in who then pulls the HDMI cable out of the PC.

 

So what I'm trying to do is to come up with a way to simply log that the PC lost its secondary display. If anyone has any clue, your help would be awesome. 


Thanks, 

 07/23/2014 02:16 AM
User is offline View Users Profile Print this message

Author Icon
Thanny
Alpha Geek

Posts: 1403
Joined: 07/13/2009

Simplest way would be to write a program that calls GetSystemMetrics(SM_CMONITORS) periodically.

Here's a simple C program that shows what it might entail (hopefully it doesn't get too mangled):

#include <windows.h>
#include <stdio.h>
#include <time.h>

int main(int argc, char *argv[])
{
    int mcount;
    FILE *monLog;
    time_t curTime;
    struct tm *timeDetail;
    char timeString[20];

    if (argc != 2)
    {
        printf("\nSpecify log file.\n");
        return 1;
    }

    monLog = fopen(argv[1], "a");
    if (!monLog)
    {
        printf("\nError opening \"%s\" for writing.", argv[1]);
        return 2;
    }

    mcount = GetSystemMetrics(SM_CMONITORS);

    time(&curTime);

    timeDetail = localtime(&curTime);

    memset(timeString, 0, sizeof(timeString));

    strftime(timeString, sizeof(timeString), "%Y-%m-%d %H:%M:%S", timeDetail);

    fprintf(monLog, "%s - %d monitor(s) detected.\n", timeString, mcount);

    fclose(monLog);

    return 0;
}

 07/23/2014 05:12 PM
User is offline View Users Profile Print this message

Author Icon
Eyesonjune
Peon

Posts: 2
Joined: 07/22/2014

Thanks so much for this. I'll give it a shot!

Statistics
85439 users are registered to the AMD Support and Game forum.
There are currently 9 users logged in.

FuseTalk Hosting Executive Plan v3.2 - © 1999-2014 FuseTalk Inc. All rights reserved.