window size
-
I have an MDI application. How can I change the default sizes for the child and parent windows when the application starts up?
In
PreCreateWindow()
of these two class: cs.x=yoursize; or cs.cx=yoursize; cs.y=yoursize; or cs.cy=yoursize; I forgot which one is the one you want,test both of them. Mazy "The path you tread is narrow and the drop is shear and very high, The ravens all are watching from a vantage point near by, Apprehension creeping like a choo-train uo your spine, Will the tightrope reach the end;will the final cuplet rhyme?"Cymbaline-Pink Floyd -
I have an MDI application. How can I change the default sizes for the child and parent windows when the application starts up?
The solution which initially springs to mind is what you can do with the PreCreateWindow function. As the name suggest, this function is called right before the window is created. The only parameter is a reference to a CREATESTRUCT. Create structs have these parameters... LPVOID lpCreateParams; HINSTANCE hInstance; HMENU hMenu; HWND hwndParent; int cy; int cx; int y; int x; LONG style; LPCTSTR lpszName; LPCTSTR lpszClass; DWORD dwExStyle; All of these variables are a goldmine of useful settings. Whats interesting about CREATESTRUCT in the context of MDI is that lpCreateParams is a pointer to a MDICREATESTRUCT. This has these members... LPCTSTR szClass; LPCTSTR szTitle; HANDLE hOwner; int x; int y; int cx; int cy; DWORD style; LPARAM lParam; with this you can do all sorts of stuff like setting the windows size, and by changing the style parameter you can get the window maximized... e.g. ((MDICREATESTRUCT*)cs.lpCreateParams)->style |= WS_MAXIMIZE; Hope that lots of use! With time we live, with money we spend! Joel Holdsworth