Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

auto-convert 800x600 resolution back to 640x480 1

Status
Not open for further replies.

ahoodin

Programmer
Jul 25, 2001
48
US
Hello all you tek-tips fans,

The Compiler MSVC 6.0 SP 4 Windows 98.

I am writing you regarding an MFC application I have co-authored, using 800x600 CWnds. Upgrading the Video hardware is not an option, so we must downgrade the resolution of the application here. I simply cant see taking 160 hours to convert this application to 640x480.... I dont want to do anything funky like make 2 dialogs 1 for each resolution that will be murder on the mod/upgrade(in any dll). I want something like a TSR app to convert all dialogs and video output from my application to 640x480 from 800x600.

Can you provide me with some ideas?

I would really appreciate it .

ahoodin

(Marvel tm)
 
One ideea would be 'smart' Dialogs:

In the InitDialog you place a call to a custom function let's call it SetObjectSizes.

Now inside this function, you can read the current resolution with GetDeviceCaps SDK function. Resize your controls to fit the resolution found on the client machine. (try to make a for loop).

Also this method SetObjectSizes should be called when you receive a WM_DISPLAYCHANGED message. Add a handler for this message (by hand, not with thwe wizard) something like this:
ON_MESSAGE(WM_DISPLAYCHANGED, SetObjectSizes). Add the handler in .h file, too.

(At least this is how I would do it)

HTH,

s-)

Blessed is he who in the name of justice and goodwill, sheperds the weak through the valley of darkness...
 
This is not a bad Idea. I have been thinking along these lines too now.

Here is my scaling algorithm:


1 REDUCE FONTS
2 RESIZE ALL CONTROL DIALOGS
a RESIZE ALL CONTROLS BY 80%
b RESIZE FONTS BY 80%
c MOVE CONTROLS TO LEFT BY FACTOR OF 80% OF THE EXIST DIST FROM THE LEFT OF DIALOG.
3 RESIZE PARENT DIALOG BY 80%

Do you have a better algorithm?
ahoodin
 
Your algorithm is pretty complete. One thing thoug, if you will use absolute numbers(e.g. 80%) you will have to do recalculation in a different way for every new resolution.

I would do it like this:
1. I would create a derived class CSmartDialog derived from CDialog with the caracteristics from my first answer.
2. I would create all my dialogs at 800x600 and I would derive it's coresponding class from CSmartDialog
3. Inside CSmartDialog I would have 2 members called
double m_dScaleOriz;
double m_dScaleVert;
whose value I will set in InitDialog based on the raport between the resolution read by GetDeviceCaps and my current one 800x600.

Why this? It is more complicated.
- Just think that you will be able to show your dialogs on ANY resolution
- CSmartDialog is reusable.

HTH,
s-)

Blessed is he who in the name of justice and goodwill, sheperds the weak through the valley of darkness...
 
I see. I like that.

It will be relatively easy to substitute CSmartDialog for all CDialogs.

All resources are already at 800x600! Bonus plan for me.
Currently my app is coded for 800x600. By default it is correct for most other video modes, but it could show preportionately to the current video mode.

Yeah, I could do #3.

All in all this will not
be half as hard as it could have been
Thanks alot, I will vote for you.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top