• 0

[VB.NET] Display Monitor Identity


Question

Hey gang,

I am looking for the api that is used (if there is one) when the user has multiple monitors and presses the "Identify" button on the Display dialog, Settings tab. (see attached image) I'm writing a an app that can take advantage of multiple monitors and I want to be able to show the user which one is which.

Thanks,

James

post-45653-1264195925305_thumb.jpg

  • Like 1
Link to comment
https://www.neowin.net/forum/topic/867666-vbnet-display-monitor-identity/
Share on other sites

7 answers to this question

Recommended Posts

  • 0

.NET has a class called Screen (in the System.Windows.Forms namespace), which represents the screens available. However, it does not have an ID associated with it, instead it just provides a device name. In order to get this in .NET, you'll have to make use of the Windows API.

I believe the DISPLAY_DEVICE structure provides what you're looking for: http://msdn.microsoft.com/en-us/library/dd183569%28VS.85%29.aspx

You can iterate through the display devices, using the EnumDisplayDevices function: http://msdn.microsoft.com/en-us/library/dd162609%28VS.85%29.aspx

(There are relevant links on both of those pages, which should give enough information to provide you with what you need to make the necessary native calls)

In addition, here is a page that gives some C# code for using EnumDisplayDevices: http://www.pinvoke.net/default.aspx/user32/EnumDisplayDevices.html

Edited by naaward
  • 0

Thanks guys,

I already knew about the Screens and AllScreens objects, and the enumDisplays basically does the same thing. What I was hoping for was a way to call that same function that the highlighted button calls. It actually shows a "1", "2", etc on each screen. I can get the height,width,left of each screen and display a number using a transparent form... I was just hoping to use the existing function that Windows uses. (if it's public)

Thanks,

James

  • 0
  On 16/02/2016 at 11:03, Nelson Rodrigues said:

hope ;)

 

Just have tried Win API, windows register, ... Nothing work consistently

Expand  

Get the array of screens from System.Windows.Forms.Screen.AllScreens and enumerate it. The one that returns true for "Primary" is #1.

 

The DeviceName property will give you a device path that should identify the ID Windows assigned it. (e.g.: "\\\\.\\DISPLAY1")

 

This is buggy on Windows XP and returns garbage in the name so you will have to parse it somehow if you're trying to support that OS.

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Posts

    • Microsoft has some PC VR games that could be played with it.
    • As such, many developers will start dropping Windows 10 support in their products Hi! Actual developer here. No we won't. It really doesn't work that way simply because most Windows devs don't target to a specific release of Windows unless we're using a feature that only exists IN a specific version, and that's pretty unusual. The biggest example would be MSFT killing off Windows Mixed Reality in Win 11, but most stuff we write for Win 10 will just work fine in Win 11 and vice versa. The vast majority of software doesn't rely on these things and will continue working on any recent version of Windows. Heck some of my software still runs on WinXP. Where Win 10 users will be left behind is software that relies on new features in Win 11 but again, we tend not to use those unless we're writing specific apps that need those features. In fact, the biggest danger area isn't apps, it's drivers as hardware makers focus on new machines more than supporting legacy devices.
    • Google Chrome finally lets you change the position of the address bar on Android by Aditya Tiwari Google is rolling out a small but useful update to Chrome. The update makes the address bar in the web browser more customizable and accessible. You can now place it at the top or bottom of the screen, as you prefer. The ability to change the position of the address bar in Google Chrome has started rolling out and will be available to all users over the coming weeks. You can long-press on the address bar and select the "Move address bar to bottom" option. Alternatively, you can also go to Settings > Address bar to customize it. "Depending on the size of your hand and your device, one address bar position may feel more comfortable than the other," the company said in a blog post. "We designed this update to give you the flexibility to choose your preferred location — so you can browse with more ease." The address bar is where you can type website names you want to visit. It's a crucial part of our browsing experience and also doubles as the search bar in Google Chrome. The browser's Android version has been around since 2012, and the address bar's top position has remained the default for most of its time. Over the years, Google has enhanced the address bar with additional features, such as the ability to automatically hide when scrolling up on a web page, thereby offering more screen real estate. A bottom-mounted address bar could be a better option for users with small hands or those who prefer to use their device with one hand. Interestingly, this is not the first time Chrome has had a bottom address bar, as Google briefly experimented with the feature in the past. The bottom address bar even made its way to Chrome for iOS, where you can long-press the address bar to toggle between the two options or change it in the settings. It's hard to digest that it took Google so long to add a simple feature. The defunct Windows Phone had this feature as far back as 2012, and Chrome's rival Safari added a Bottom layout option in 2021. Nonetheless, the latest update brings Chrome in line with other browsers that offer a bottom address bar on Android.
    • That's just my understanding of the courts situation with the law with of AI and when could be copyrighted. Found this article about how different area's of the world are handling copyrights - https://www.cooley.com/news/in...uts-varies-around-the-world AI seems to be a disruptive technology so far, like the internet was. Whenever a disruptive tech comes out, it takes a while on what societies accepts, adapts, rejects, and how it ultimately pans out.
  • Recent Achievements

    • Week One Done
      DrRonSr earned a badge
      Week One Done
    • Week One Done
      Sharon dixon earned a badge
      Week One Done
    • Dedicated
      Parallax Abstraction earned a badge
      Dedicated
    • First Post
      956400 earned a badge
      First Post
    • Week One Done
      davidfegan earned a badge
      Week One Done
  • Popular Contributors

    1. 1
      +primortal
      616
    2. 2
      ATLien_0
      227
    3. 3
      +FloatingFatMan
      170
    4. 4
      Michael Scrip
      166
    5. 5
      Som
      148
  • Tell a friend

    Love Neowin? Tell a friend!