how to adjust the window?

I have drawn a cube container on screen,but when I resize the window ,the shape of container change constant.I want to display based on the max of the length and height of the container,but I don’t know how to do,please give me some advice,thanks a lot!

Could you please rephrase a little bit better because I’m not sure what you are asking.? Also include information about what windowing system you’re using: win32, x, glut, another.

I use win32 system,and when I resize the view window,the object in it don’t change according to the ratio.in fact I hope the window change with the maxsize of object.such as when the Width is bigger than the Height,I will display according to the Width,in other word,display the Width to the full,and the Height meet with the Width!
hope the illstrated above you can see,and give me some help,thanks in advance!

Ok, I still don’t get the problem but try putting:
glOrtho(-200, 200, -200, 200, -100, 100); in your WM_SIZE handler in WndProc. The coordinates need not be the same but if you want your object’s size to change with the size of the window you should create a view volume that doesn’t change according to window size.

Do you want your window size to change autmatically when the container (the box) changes size? If that’s the case I suggest you look at SetWindowPos from the win32 api functions.
If you want your box to change size when you resize the window it is all a matter of making an appropriate glOrtho or glFrustum call.
If you need further help post again. But in general in the switch statement, your WndProc function should include something like:

case WM_SIZE:	//window is being resized

  height = HIWORD(lParam);	//retrieve height and width
  width = LOWORD(lParam);

  if (height == 0)		//make certain we don't divide by 0
  height = 1;

  //reset the viewport to new dimensions
  glViewport(0, 0, width, height);
  glMatrixMode(GL_PROJECTION);	//set projection matrix
  glLoadIdentity();	//reset projection matrix
  gluPerspective(45.0, (GLfloat) width / (GLfloat) height, 1, 100);
  glMatrixMode(GL_MODELVIEW);		//set modelview matrix
  glLoadIdentity();	
  break;

If possible try to post a picture of what you want to achieve. I’m really sorry that I can’t understand you. I’m not a native english speaker.

first of all,I thank you very much,and I have try it,but I can’t solve it out.if it is convenient,please tell me your E-MAIL,I send the code to you,you can see the problem!