How can I stop an application launched with CreateProcess() from resizing my screen resolution to 640x480? Or how do I resize it back quickly?
How can I stop an application launched with CreateProcess() from resizing my screen resolution to 640x480? Or how do I resize it back quickly?
just have a program running in the background that checks any change in the current desktop dimensions, then if they change, set them back to the original settings that you wanted.
How do I set them back? The program that called CreateProcess() will still be running ...
from NeHe's OpenGL tutorials, should work perfectly fine. Just change width/height/bits to the settings you want.Code:DEVMODE dmScreenSettings; // Device Mode memset(&dmScreenSettings,0,sizeof(dmScreenSettings)); // Makes Sure Memory's Cleared dmScreenSettings.dmSize=sizeof(dmScreenSettings); // Size Of The Devmode Structure dmScreenSettings.dmPelsWidth = width; // Selected Screen Width dmScreenSettings.dmPelsHeight = height; // Selected Screen Height dmScreenSettings.dmBitsPerPel = bits; // Selected Bits Per Pixel dmScreenSettings.dmFields=DM_BITSPERPEL|DM_PELSWIDTH|DM_PELSHEIGHT; // Try To Set Selected Mode And Get Results. NOTE: CDS_FULLSCREEN Gets Rid Of Start Bar. if(ChangeDisplaySettings(&dmScreenSettings,CDS_FULLSCREEN)!=DISP_CHANGE_SUCCESSFUL) { char temp[1024]; sprintf(temp,"The Requested Fullscreen Mode Is Not Supported By\nYour Video Card. Use Windowed Mode Instead?\n%dx%d",width,height); if(MessageBox(NULL,temp,"ERROR",MB_YESNO|MB_ICONEXCLAMATION)==IDNO) { MessageBox(NULL,"Program Will Now Close.","ERROR",MB_OK|MB_ICONSTOP); return FALSE; } }
For testing if the resolution changes, you'll have to just set a timer to the program to check every half second or any amount of time to see if it changed. There's many ways of determining the desktop resolution, you should be able to find a way very easily (I don't have any code in my library for doing that, sorry)
Well I can just use the GetSystemMetrics() to get the dimensions, just needed the actual code for changing resolution... cheers for that!
Ok, well what I was trying didn't work.
Here's the scenario -
I just got a new laptop, it's widescreen. I want to play starcraft (like my favourite old time game) but it looks a little weird because it get's stretched out on the x-axis. I've tried just setting the resolution back but it doesn't really seem to work, I just get a black game window with nothing in it...
It runs on direct x 5, is there perhaps a way I can hook any calls it'll make to set the screen resolution??
i believe what's happening is when you try to force it to change the screen resolution, it's losing focus to the drawing area for the game, and it causes it to not be able to render correctly anymore. I can't really think of any way to manipulate DirectX to force it to change resolutions while in another program and not lose focus to the ddraw stuff. Is there anything hardware related that you could change possibly?
well, then i don't think there's any way to really fix it software-wise, unless you can make the game run in windowed mode, but I don't think you can do that with starcraft. Possibly someone else here knows a trick to get this working. Sorry I couldn't be too much help.
There has to be a way, I have another patch that does actually resize it into a window but the cursor easily moves out of the window and so you can't really scroll the view (like when you move to the top, you scroll up the map, down you scroll down etc ... if you haven't played it or any similar rts games before ) ..
I don't think there are any command lines you can pass or config settings you can edit to make it run windowed ...
i can't remember, but doesn't starcraft have arrow key scrolling? So you could just use the arrow keys to scroll around. I'm not sure if that's in there or not though, I know it's in AOE and RoN....
I think I have come up with a new solution.. Just going to try it out.