How do you start a Window as MAXIMIZED using Borland C++ 3.1 & OWL?

How do you start a Window as MAXIMIZED using Borland C++ 3.1 & OWL?

Post by J. Chris Cla » Sun, 07 Feb 1993 01:35:00



As the subject line says, I'm using Borland's OWL and I'm wondering if there is
a relatively simple way of getting the application to ALWAYS start MAXIMIZED.
(I know you can go into File|Properties if it's in a Program Manager Group,
but that isn't what I want.)
IS there some bit-flag I can set somewhere so that Windows will always start
it up MAXIMIZED?  Also, is there a way to prevent it from being resized ever?
Can this be set according to a command line parameter?  For that matter, how
do you get command line arguments with OWL?
(I know about arggc and argv in C/C++, but how does Windows affect them (or
what does Windows do instead of them?)

Replies by e-mail appreciated, although I'll probably catch them if you post
to the net too.  (And I don't think this is in the FAQ, I downloaded the
Win31 Help format encoded FAQ files from sony and didn't see it in there.)

Thanks in advance,
Chris C.

 
 
 

How do you start a Window as MAXIMIZED using Borland C++ 3.1 & OWL?

Post by John Gra » Sun, 07 Feb 1993 03:34:17



Quote:>As the subject line says, I'm using Borland's OWL and I'm wondering if there is
>a relatively simple way of getting the application to ALWAYS start MAXIMIZED.
>(I know you can go into File|Properties if it's in a Program Manager Group,
>but that isn't what I want.)
>IS there some bit-flag I can set somewhere so that Windows will always start
>it up MAXIMIZED?

        After CreateWindow(), use ShowWindow(hwnd,SW_SHOWMAXIMIZED);

  Also, is there a way to prevent it from being resized ever?
        I think you can intercept WM_GETMINMAXINFO and process that

Quote:>Can this be set according to a command line parameter?  For that matter, how
>do you get command line arguments with OWL?
>(I know about arggc and argv in C/C++, but how does Windows affect them (or
>what does Windows do instead of them?)

        You have 2 choices:
        (a) get the unparsed whole command line from the 3rd parameter
                of WinMain
        (b) just use globals _argc & _argv and do it just like you
                would in a DOS program, except you are using _argc
                and _argv instead of:
                main(int argc,char **argv)

Quote:>Replies by e-mail appreciated, although I'll probably catch them if you post
>to the net too.  (And I don't think this is in the FAQ, I downloaded the
>Win31 Help format encoded FAQ files from sony and didn't see it in there.)

>Thanks in advance,
>Chris C.

--

Airborne Geophysics
Geological Survey of Canada, Ottawa

 
 
 

How do you start a Window as MAXIMIZED using Borland C++ 3.1 & OWL?

Post by michael a vinc » Sun, 07 Feb 1993 06:36:22



|> As the subject line says, I'm using Borland's OWL and I'm wondering if there is
|> a relatively simple way of getting the application to ALWAYS start MAXIMIZED.
|> (I know you can go into File|Properties if it's in a Program Manager Group,
|> but that isn't what I want.)
|> IS there some bit-flag I can set somewhere so that Windows will always start
|> it up MAXIMIZED?  Also, is there a way to prevent it from being resized ever?
|> Can this be set according to a command line parameter?  For that matter, how
|> do you get command line arguments with OWL?

A while ago I did this using BPW.  Below is an excerpt of my code.
Another way (this is off the top of my head) is to overload the
InitMainWindow method and change the global cmdshow variable, and
overload the WMSIZE method so a resizing is not allowed.  The method
below uses the system metrics to initially size the window, disable
the minimize, maximize buttons, and modify the system menu (to not
allow sizing.)  The purpose of my program was to write a learning/game
program for my 1-2 year old, so no matter what she did, she could not
access anything else in windows by covering the entire screen with
her game.

constructor TBrittanyWindow.Init (AParent: PWindowsObject; ATitle: PChar);
begin
TWindow.Init (AParent, ATitle);
{ Maximize window.  Note the +2 is to account for the border.  You could
  use sm_xxxx with GetSystemMetrics (I forget the name of whcih sm_xxx
  to use) in order to get a system independant solution.

Quote:}

Attr.X := 0;
Attr.Y := 0;
Attr.W := GetSystemMetrics (sm_CXFullScreen) + 2;
Attr.H := GetSystemMetrics (sm_CYFullScreen) + 2;

{ Setup window to basically only have a system menu  (ie: no
  minimize or maximize buttons.

Quote:}

Attr.Style := ws_Maximize + ws_DlgFrame + ws_SysMenu;
end;

procedure TBrittanyWindow.SetupWindow;
var
  SystemMenu: HMenu;
begin
TWindow.Setup;
SystemMenu := GetSystemMenu (HWindow, False);
{ Delete all system menu items and add an item to allow you to
  close the application.

Quote:}

while GetMenuItemCount (SystemMenu) > 0 do
  DeleteMenu (SystemMenu, 0, mf_ByPosition);
AppendMenu (SystemMenu, mf_String, sc_Close, '&Close'^I'Alt+F4');
end;

|> (I know about arggc and argv in C/C++, but how does Windows affect them (or
|> what does Windows do instead of them?)

In windows it is possible to add command line arguements.  For example
if you want to run notepad and automatically bring up win.ini, then
from the Program Manager's menu select run and enter "notepad win.ini".
Note that when you associate an application with a file in File Manager,
and you double click on the file, the filename gets passed to the program
as the first command line arguement.

I hope the above helps.  Some items may need some refinement but it
should be a starting point.

Best regards,
Michael Vincze

 
 
 

How do you start a Window as MAXIMIZED using Borland C++ 3.1 & OWL?

Post by Michael James Port » Sat, 13 Feb 1993 07:51:50



Quote:>As the subject line says, I'm using Borland's OWL and I'm wondering if there is
>a relatively simple way of getting the application to ALWAYS start MAXIMIZED.

Replace the program parameter nCmdShow (4th param to WinMain) with the
proper one for maximize before calling the constructor for your
application.  I *think* you want one of the SWP_ constants,
but I don't have a manual here to check.

As far as keeping it that way:  One easy way is:

In TYourWindow::SetupWindow...

Attr.Style = ::GetWindowLong( HWindow, GWL_STYLE );
Attr.Style &= ~WS_MAXIMIZEBOX;
::SetWindowLong( HWindow, GWL_STYLE, Attr.Style );

This will prevent the restore box from being displayed.  It also
seems to disable the Restore option on the system menu.  I would
then also define a WMSize routine and look for sizing that I don't
want to allow.

Mike

 
 
 

1. Selling Borland C++3.1 (for DOS & WIndows 3.1), asking $200

I know this group isn't for selling, but I noticed a lot of people here
are either using BC++3.1, or asking about good Windows development tools.

First of all, forget the SDK, it isn't that great.  All you need is this
compiler and a few books you can get at any bookstore.  Plus, this
compiler has all the Windows stuff online anyway with formatted text
and examples.  And the resource editor is way better than anything I've
seen Microsoft produce.  

I posted this twice already to misc.forsale, but here is one more notice
for anyone who might have missed it.  

What am I selling?
The best (my opinion) compiler for any IBM PC, Borland C++ 3.1 for
Windows 3.1 and DOS.  This is a complete package including C++, an
object oriented assembler, debugger, and code profiler.  No, it does not
have the application frameworks class libraries, sorry, but it does have
all the stuff you need to make really slick DOS or Windows programs.  
If you want to know more, read reviews about it, or email me.  It
comes with all 9 manuals (still in wrapping) and 15 high density 5.25"
diskettes, and all the warranty registration stuff.

NOTE - If you want the application frameworks, there is an offer card
included to get it from Borland directly for $199 extra.

What am I asking?
Borland's list prices are as follows:
BC++3.1 AND Application Frameworks  $795
BC++3.1 (What I'm selling)  $495
BC++3.1 upgrade from 3.0   $99 or $199, I forget which.
BC++3.1 Application Frameworks Upgrade to BC++3.1  $199

A local discount software store is currently charging $350.
I would like to get $200, but I will consider any other offers.

Why am I selling this?
I ordered Borland C++3.1 with my PC a long time ago, and it finally
arrived a few weeks ago, long after I broke down and bought it in a
store.  It IS the latest version, with all the manuals and registration
cards and disks unopened.  I use this product (my copy) all the time,
and it is worth every penny and then some.  It takes away most of the
frustration of programming with PCs and Windows.  I have an extra
copy, and was hoping someone out there was about to buy this
program anyway, and would like to get a deal.

Is there anybody out there looking for a good C++ compiler?

If anyone who previously mailed me is still interested, please mail me
again, a lot of that mail got deleted.

- Tom

2. WHY NOT INCLUDE THE AIKIKO?

3. Borland C++ 3.1 & AF compare to Borland C++ 4.0?

4. Writers/Wanted/nycAgency

5. ANSI C++ compliance...

6. Maximize DOS shell window in Windows 3.1

7. lha/lharc for UNIX (AIX v3.25)

8. IBM DOS/Win 3.1/Borland C++ 3.1 Problems?

9. Where can I find Borland C++ 3.1 for Windows/DOS?

10. Borland C++ 3.1 Windows/DOS, Where can I find it?

11. WANTED: Windows 3.1 DDK (for DOS 5.0 & C/C++ 7.0) -- Cheap

12. Borland C++ 3.1 - Windows 3.1 Application memory problem