Announcement

Collapse
No announcement yet.

How to get available display resolutions without dllbind.

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • replied
    I'm using the following to get the supported resolutions.
    Code:
    ConsoleCommand("DUMPAVAILABLERESOLUTIONS", false);
    It works great, however it always writes the values to the log file as a side-effect. Is there anyway to prevent this? Just to keep my logs clean.

    Leave a comment:


  • replied
    Thanks a lot for this !

    Leave a comment:


  • replied
    Originally posted by reinrag View Post
    I'm not sure if that's doable in UScript and if it isn't then DLLBind should be fine. In your case you'd want to access dmDisplayFrequency from the DEVMODE structure; here's a quick example
    Code:
    #include <stdio.h>
    #include <windows.h>
    #include <wchar.h>
    
    extern "C"
    {
    	__declspec( dllexport ) int RefreshRate()
    	{
    		DEVMODE __sScreen;
    		memset( &__sScreen, 0, sizeof( __sScreen ) );
    		if( !EnumDisplaySettings( NULL, 0, &__sScreen ) )
    		{
    			MessageBoxW( NULL, L"Could not get refresh rate.", L"Fail window", MB_ICONERROR );
    			return -1;
    		}
    		wchar_t __cMessage[ 80 ];
    		swprintf( __cMessage, 80, L"Current refresh rate: %i Hz", __sScreen.dmDisplayFrequency );
    		MessageBoxW( NULL, __cMessage, L"Refresh-rate window.", MB_OK );
    	}
    }
    Although I've used MessageBoxW - it isn't needed. If you don't want a message box then you can remove it.
    Thanks for you guys help.

    Leave a comment:


  • replied
    I'm not sure if that's doable in UScript and if it isn't then DLLBind should be fine. In your case you'd want to access dmDisplayFrequency from the DEVMODE structure; here's a quick example
    Code:
    #include <stdio.h>
    #include <windows.h>
    #include <wchar.h>
    
    extern "C"
    {
    	__declspec( dllexport ) int RefreshRate()
    	{
    		DEVMODE __sScreen;
    		memset( &__sScreen, 0, sizeof( __sScreen ) );
    		if( !EnumDisplaySettings( NULL, 0, &__sScreen ) )
    		{
    			MessageBoxW( NULL, L"Could not get refresh rate.", L"Fail window", MB_ICONERROR );
    			return -1;
    		}
    		wchar_t __cMessage[ 80 ];
    		swprintf( __cMessage, 80, L"Current refresh rate: %i Hz", __sScreen.dmDisplayFrequency );
    		MessageBoxW( NULL, __cMessage, L"Refresh-rate window.", MB_OK );
    	}
    }
    Although I've used MessageBoxW - it isn't needed. If you don't want a message box then you can remove it.

    Leave a comment:


  • replied
    It doesn't list refresh rates.

    Leave a comment:


  • replied
    wish i had saw this about 3 weeks ago, really needed some resolution options for my uni project. does this display the screen screen res X refresh rate? if not could it easily be added?

    Leave a comment:


  • replied
    Wow !!

    Thanks a lot !

    Leave a comment:


  • replied
    PS hivemind has verified that SCALE DUMP does indeed write properly to string in the 2012-07 build, doesn't in 05 we're currently on. Crisis averted. It seems that it's the only way to get those values aside from reading the .ini directly in dllbind'd library.

    Leave a comment:


  • replied
    My bad, seems not everything we want to get at is declared as config. Also getting at them via a class's default value (defprop values are set from the config when a class is loaded) means it probably wont pick up on runtime changes. Will get back if anything sensible drops out
    Scale Dump isnt writing to a string for me on 2012-05 :/

    Leave a comment:


  • replied
    Care to elaborate on "you can read any of those values from the config on demand", as far as I know you can only mirror them or use DLLBind to read those config properties from the ini yourself.

    No obviously :P

    [Edit]: I just tried it on "Scale Dump" and this is definitely working now! Sweet

    Leave a comment:


  • replied
    No idea, probably not. Sounds more hassle than its worth any way- you can read any of those values from the config on demand, and pick and choose the ones you want, and not have to faff around mapping array entries to intended parameters. I certainly wouldnt recommend directly exposing ALL the vars to users in an options menu either?

    Leave a comment:


  • replied
    Did they fix this as well for the other console commands that dumps all systemsettings?

    Leave a comment:


  • replied
    Originally posted by Jetfire View Post
    Yea, nick_p did a native code change to make it work for us. Sorry to obsolete your tutorial ;p
    It's progress. And for the better

    Leave a comment:


  • replied
    Yea, nick_p did a native code change to make it work for us. Sorry to obsolete your tutorial ;p

    Leave a comment:


  • replied
    Nice one, mister Jetfire. I saw someone attempt to use that console function without success, but I hadn't got around to experimenting with the later builds to test it. I'll update my tutorial with a link to here.

    Leave a comment:

Working...
X