c# - check if the monitor is connected -


i've make simple program reports server state of monitor (is on/off or if it's not connected). far i'm using method found on discussion, returns me true every times, if i've disconnected monitor.

public static boolean ismonitoractive()          {             boolean active = false;             var query = "select * wmimonitorbasicdisplayparams";             using (var wmisearcher = new managementobjectsearcher("\\root\\wmi", query))             {                 var results = wmisearcher.get();                 foreach (managementobject wmiobj in results)                 {                     // "active" property , cast boolean, should                      // tell if display active. i've interpreted mean "on"                     active = (boolean)wmiobj["active"];                     return active;                 }             }             return active;         } 

i've check status of monitor every 2-3 minutes, need use different monitorcout variable in system, because it's initialized , remain same beginning end of program (if i'm not mistaken). reading , helping.


Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -