-
Mar 17th, 2025, 06:27 AM
#1
Thread Starter
PowerPoster
Change screen resolution FAO J. Mcilhinney
Hi John,
In October 2023 I posted a question with regard to changing the screen resolution, to which you replied:
Re: Change screen resolution
There's nothing built into .NET to set the screen resolution. You will have to use the appropriate Windows API function(s). This was written for VB6 but the same principle applies in VB.NET.
But at that time I found a solution without having to implement anything. Now, because I couldn't buy a new Win.10 laptop I have the same problem that I had back then with a Win.11 one.
So again I would like to find a way to change the resolution using vb.NET, your comment then was to use the appropriate Windows API function, that's fine, but I have no idea how to do that, I tried looking at https://learn.microsoft.com/en-us/wi...ndows-api-list, but I can't find where or what to look for specifically. I tried looking at things which seemed appropriate but couldn't understand much of what I was reading.
Maybe you could point me to the API that you were referring to, even then I'm not confident that I'll understand it or (especially) how to use it.
Also I've never used VB6 but I'm hopeful I'd be able to work out the principal.
Poppa
Along with the sunshine there has to be a little rain sometime.
-
Mar 17th, 2025, 06:51 AM
#2
Re: Change screen resolution FAO J. Mcilhinney
Perhaps you could link to the original thread, so I can see what VB6 link/code I was referring to.
As for the generalities of invoking the Windows API, you should do some research on Platform Invoke (pinvoke). Basically, you declare a method that maps to a function in an unmanaged library and then you call that method like you would any other. In VB6, you would use the Declare keyword to declare the external function. You can do the same in .NET but it is preferred to use the DllImport attribute or, more recently, the LibraryImport attribute. Sometimes you need to funble around a bit for the right method signature. pinvoke.net is a good place to start and you can usually find examples strewn about the web. If a method signmature was written for VB6, be sure to change all Long data types to Integer.
-
Mar 18th, 2025, 03:58 AM
#3
Re: Change screen resolution FAO J. Mcilhinney
 Originally Posted by Poppa Mintin
So again I would like to find a way to change the resolution using vb.NET, your comment then was to use the appropriate Windows API function, that's fine, but I have no idea how to do that, I tried looking at https://learn.microsoft.com/en-us/wi...ndows-api-list, but I can't find where or what to look for specifically. I tried looking at things which seemed appropriate but couldn't understand much of what I was reading.
There are various monitor APIs you can use. First, you need to read all possible resolutions of the connected monitors. You can use the following APIs for this: EnumDisplayMonitors, GetMonitorInfo -> MONITORINFOEX structure, EnumDisplaySettingsEx -> DEVMODE structure. You need one of the DEVMODE structures and MONITORINFOEX.szDevice for the ChangeDisplaySettingsEx API to set the appropriate resolution for a specific monitor.
-
Mar 18th, 2025, 05:08 AM
#4
Re: Change screen resolution FAO J. Mcilhinney
- Coding Examples:
- Features:
- Online Games:
- Compiled Games:
-
Mar 19th, 2025, 06:40 PM
#5
Thread Starter
PowerPoster
Re: Change screen resolution FAO J. Mcilhinney
 Originally Posted by jmcilhinney
Perhaps you could link to the original thread, so I can see what VB6 link/code I was referring to.
My apologies for the delay in replying, the original thread was : Change screen resolution, marked as resolved, Oct 21st, 2023, 04:10 PM
Pop.
Along with the sunshine there has to be a little rain sometime.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|