• 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

    • I had this issue and it is a nova android conflict issue. Initially the only way to fix it was clicking the screen off and then back on. Figured out it was because of a task I set up in tasker to load certain apps when I connect to my car, so fixed it by adding a 'go home' task after the app loaded and rarely have the issue now
    • I wish one of the windows updates hadn't broken glass. Is there a workaround for that I'm not aware of?
    • OpenAI announces o3 Pro, its most intelligent reasoning model by Pradeep Viswanathan OpenAI today announced o3-pro, its flagship reasoning model that uses more compute to "think harder" and provide consistently better answers. This new model will be replacing o1-pro in ChatGPT since it consistently performs better in math, science, and coding. To help everyone make the most out of the model, o3-pro supports tool calling. So, based on the user prompt, the model can do a web search, analyze files, reason about visual inputs, use Python, personalize responses using memory, and more. This is a big improvement over o1-pro, which lacked access to tools. But the downside is that o3-pro will take more time to respond. OpenAI recommends users use o3-pro in cases where reliability matters more than speed. According to OpenAI's evaluations, users consistently preferred o3-pro's responses over o3 in key domains like science, education, programming, business, and writing help. o3-pro was also rated consistently higher for clarity, comprehensiveness, instruction-following, and accuracy. The new o3-pro model is available in ChatGPT's model picker for Pro and Team. ChatGPT's Enterprise and Edu users will get access to this latest model next week. For developers, the o3-pro model comes with a 200,000 context window and is priced at $20 per million input tokens and $80 per million output tokens. OpenAI recommends developers use background mode with o3-pro to prevent timeouts. And the model has a May 31, 2024 knowledge cutoff. The OpenAI team also noted the following as the current limitations of the o3-pro model: At the moment, temporary chats are disabled for o3-pro as we resolve a technical issue. Image generation is not supported within o3-pro—please use GPT-4o, OpenAI o3, or OpenAI o4-mini to generate images. Canvas is also currently not supported within o3-pro. As OpenAI continues to refine its models, the balance between speed and reliability will likely remain a key consideration for users choosing the right tool for their needs.
  • Recent Achievements

    • Reacting Well
      rshit earned a badge
      Reacting Well
    • Reacting Well
      Alan- earned a badge
      Reacting Well
    • Week One Done
      IAMFLUXX earned a badge
      Week One Done
    • One Month Later
      Æhund earned a badge
      One Month Later
    • One Month Later
      CoolRaoul earned a badge
      One Month Later
  • Popular Contributors

    1. 1
      +primortal
      541
    2. 2
      ATLien_0
      269
    3. 3
      +FloatingFatMan
      210
    4. 4
      +Edouard
      203
    5. 5
      snowy owl
      140
  • Tell a friend

    Love Neowin? Tell a friend!