I'm writing an application with Embarcadero RAD 2 Studio (borland) and the owlNext library.
There I create a TDecoratedMDIFrame
Object, which I open by using
class TMDIApp : public owl::TApplication { // -------------------------------
public:
TMDIApp() : owl::TApplication(ProgName) {}
TMDIApp(const char far* name, HINSTANCE instance, HINSTANCE prevInstance, const char far* cmdLine, int cmdShow) : owl::TApplication(name, instance, prevInstance, cmdLine, cmdShow) {}
void InitMainWindow();
};
void TMDIApp::InitMainWindow() { // --------------------------
PMAcMDI = new TMAcMDI;
PMW = new TDecoratedMDIFrame(ProgName, MAC_MENU, *PMAcMDI);
MainWindow = PMW;
}
int OwlMain(int, char* []) { // ------------------------
return TMDIApp().Run();
}
So, in the end it get's opened by aplicat.cpp of the owlnext library using MainWindow->ShowWindow(nCmdShow);
.
However, Now I want to open it maximized.
I made some research and came upon
PMW->WindowProc(WM_SIZE,SIZE_MAXIMIZED,0);
Which doesn't seem to do anything...
Does anyone of you know how to maximize this window or starting it maximized?
I found information about this problem at an old archive.org copy of the "OWL Programmer's Guide" http://archive.org/stream/bitsavers_borlandborindowsforCVersion2.0ProgrammersGuideOct9_19152845/Borland_ObjectWindows_for_C_Version_2.0_Programmers_Guide_Oct93_djvu.txt
There it says:
~ ~ You can change how your application's main window is displayed by
Specifying the mam setting the T Application data member nCmdShow, which corresponds to the ^ / WinMain parameter nCmdShow. You can set this variable as soon as the Run
function begins, up until the time you call T Application: :lnitlnstance. This effectively means you can set nCmdShow in either the InitApplication or InitMainWindow function.
For example, suppose you want to display your window maximized whenever the user runs the application. You could set nCmdShow in your InitMainWindow function:
include ttinclude
class TMyApplication : public TApplication { public :
TMyApplication (char far *name) : TApplication (name) {}
void InitMainWindow () ;
1; ■ ■
void TMyApplication: : InitMainWindow () {
SetMainWindow(new TFrameWindow ( , "Maximum Window") ) ; nCmdShow = SW_SHOWMAXIMIZED;
- } int '
OwlMain(int argc> char* argv[]) {
, return TMyApplication("Wow!").Run(); } '
nCmdShow can be set to any value appropriate as ( a parameter to the ShowWindow Windows function or the TWindow::Shozv member function, such as SW_HIDE, SW_SHOWNORMAL, SW_NORMAL, and so on.
So, in my case, adding nCmdShow = SW_SHOWMAXIMIZED;
inside my InitMainWindow ()
definition was enough.