Advertisement

Is this code Win2000/ME compatible?

Started by November 05, 2000 06:11 PM
0 comments, last by 1kevgriff 24 years, 2 months ago
Just curious, I am using this code to change the screen resolution:
    

DEVMODE DevMode;
memset(&DevMode, 0, sizeof(DEVMODE));
DevMode.dmSize  = sizeof(DEVMODE);
DevMode.dmBitsPerPel = 16;   // Bits per pixel

DevMode.dmPelsWidth = 640;   // X Resolution

DevMode.dmPelsHeight = 480;  // Y Resolution

DevMode.dmFields = DM_PELSWIDTH | DM_PELSHEIGHT | DM_BITSPERPEL;
ChangeDisplaySettings(&DevMode, CDS_GLOBAL);

    
I change dmPelsWidth and dmPelsHeight to the different resolutions, and it works fine on my computer (Win98 sys). But another guy I know (running Win2000) says it doesn''t change the resolution. Thanks a lot.
If you haven''t allready, checking the return of ChangeDisplaySettings on the Windows 2000 machine would most likely give the answer.

Otherwise, try getting rid of the CDS_GLOBAL flag, or adding the CDS_UPDATEREGISTRY flag. The copy of the Win32 API docs I have states that global is invalid when updateregistry isn''t used, and also says that the function fails on NT if it''s told to, but cannot write to the registry.
I guess using global, it assumes you want it to write the registry, but you told the function not to write the registry by omiting the updateregistry flag, and as such fails. I don''t have access to a machine running NT to check this though.

This topic is closed to new replies.

Advertisement