Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7444979
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T11:42:35+00:00 2026-05-29T11:42:35+00:00

_WinAPI_EnumDisplayDevices() reports 3 additional virtual monitors I don’t need. So I’ve created an If

  • 0

_WinAPI_EnumDisplayDevices() reports 3 additional virtual monitors I don’t need. So I’ve created an If statement where if specific flags come about (such as 1, 2, 3, 35, or 33), it only returns those monitors. However, it bugs me how long my conditional statement is:

$_enum = _WinAPI_EnumDisplayDevices("", $x)
If $_enum[3] = 1 OR $_enum[3] = 2 OR $_enum[3] = 3 OR $_enum[3] = 33 OR $_enum[3] = 35 Then

How to get same results with less code?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T11:42:36+00:00Added an answer on May 29, 2026 at 11:42 am

    Discovered _ArraySearch() allows to search a value in an array, and returns different flags based on what it finds or doesn’t. So I can create an array with all values, then perform an _ArraySearch() for $_enum[3] against the array.

    I ended up with:

    Dim $x = 0, $y = 0, $_enum, $_PhysMon[15] = [1,2,8,32,3,9,33,10,34,40,11,35,36,42,51], $_DefMon[8] = [2,3,10,34,11,35,42,43]
    Do
        $_enum = _WinAPI_EnumDisplayDevices("", $x)
        $_physCheck = _ArraySearch($_PhysMon, $_enum[3])
        $_defCheck = _ArraySearch($_DefMon, $_enum[3])
        $x+=1
        msgbox(0,"","Phys Check:  " & $_physCheck & @LF & "Def Check:   " & $_defCheck)
        If $_physCheck <> -1 AND %_defCheck <> -1 Then
            msgbox(0,"","Monitor " & $x & " IS THE PHYSICAL DEFAULT MONITOR")
        ElseIf $_physCheck <> -1 Then
            msgbox(0,"","Monitor " & $x & " IS A PHYSICAL MONITOR")
        Else
            msgbox(0,"","Monitor " & $x & " IS A VIRTUAL MONITOR")
        EndIf
    Until NOT $_enum[3]
    

    I’ve set all possible combinations of flags, successfully parsed what monitors are real (physical) vs not real (virtual) and even defined the machine’s default display as well.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there any WinAPI WinExec analog in boost (c++) libraries? I need to run
Is there some WinAPI call which would tell me who (which process) has created
Is there any fundamental differences in the WinAPI/Win32? Is there any additional knowledge required
I need to replace all WinAPI calls of the CreateFile, ReadFile, SetFilePointer, CloseHandle with
I have created a small app in C using WinAPI and I have a
I need to show bitmaps on my MFC/WinAPI application window. The bitmap size may
I have a program I am making in C++ WinAPI & I need to
WinAPI OpenFile function returns HFILE, and GetFileTime for instance needs HANDLE. When I feed
I've forgotten the WinAPI call to find out how much space is remaining on
I have a pure Winapi application that needs a few new features. One of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.