PowerBASIC Forums
  PowerBASIC Console Compiler
  Window Size from Random to Fixed.

Post New Topic  Post A Reply
profile | register | preferences | faq | search

UBBFriend: Email This Page to Someone! next newest topic | next oldest topic
Author Topic:   Window Size from Random to Fixed.
Frank Ferrell
Member
posted June 05, 2003 04:11 PM     Click Here to See the Profile for Frank Ferrell     Edit/Delete Message   Reply w/Quote
UPDATE 6/11/2003 -- see latest post from me

Greetings --

I am a newcomer to Console Compiler. My question is ..

Is there a function or SUB-routine - which can be executed at the start of any program - that will automaticly change the program's Window Box size from Random to Fixed ??

Click on this image link - it illustrates what I'm inquiring about.

The type of function (or SUB-routine) would be used in conjunction with a CONSOLE SCREEN setting of 26,80 and a non-CLS format where the screen is cleared with this SUB-Routine (or appropriate variations of it).

SUB DaBlackGround

COLOR 0,0
LOCATE 1,1
Print STRING$(2080,32)

END SUB

The idea is to have a screen who size won't change, allowing for a PBCC program that closely resembles a old-fashioned DOS program. At least that's the theory!

Thanx-A-Lot and Enjoy -- Frank

[This message has been edited by Frank Ferrell (edited June 11, 2003).]

IP: Logged

Pierre Bellisle
Member
posted June 05, 2003 06:20 PM     Click Here to See the Profile for Pierre Bellisle     Edit/Delete Message   Reply w/Quote
Welcome aboard Frank,
is this what you want...


#COMPILE EXE
#DIM ALL
#INCLUDE "WIN32API.INC"

'______________________________________________________________________________

FUNCTION PBMAIN() AS LONG
LOCAL Hndl AS DWORD

CONSOLE SCREEN 26, 80
Hndl = GetForegroundWindow

SLEEP 1000
SendMessage Hndl, %WM_SYSCOMMAND, %SC_MAXIMIZE, 0
PRINT "Window is maximized"
SLEEP 1500 : CLS : SLEEP 500
SendMessage Hndl, %WM_SYSCOMMAND, %SC_RESTORE , 0
PRINT "Window is Restored"
SLEEP 1500 : CLS : SLEEP 500

PRINT "Press any key or mouse button to end..."
MOUSE ON : MOUSE 3, UP : WAITKEY$

END FUNCTION
'______________________________________________________________________________

[This message has been edited by Pierre Bellisle (edited June 05, 2003).]

IP: Logged

Frank Ferrell
Member
posted June 05, 2003 06:46 PM     Click Here to See the Profile for Frank Ferrell     Edit/Delete Message   Reply w/Quote
Greetings --

I'm using PBCC v 2.0 - and have discovered the CONSHNDL statement/function is available only on PBCC v3 and up !!! No wonder I keep getting an error message!

Guess it's time to upgrade -- thanks anyway for your reply.

------------------
Thanx-A-Lot and Enjoy, Frank

[This message has been edited by Frank Ferrell (edited June 05, 2003).]

IP: Logged

Pierre Bellisle
Member
posted June 05, 2003 07:11 PM     Click Here to See the Profile for Pierre Bellisle     Edit/Delete Message   Reply w/Quote
Frank,
did some modification to the code above,
it should work under CC/2...

------------------

IP: Logged

Frank Ferrell
Member
posted June 05, 2003 07:31 PM     Click Here to See the Profile for Frank Ferrell     Edit/Delete Message   Reply w/Quote
Greetings --

Thanks Pierre -- the code worked this time -- it did expand the window and set it to maximized mode.

However, it doesn't quite maximize when I try to run a test program of my own. Here's the code --

#COMPILE EXE
#DIM ALL
#INCLUDE "WIN32API.INC"

FUNCTION PBMAIN() AS LONG
LOCAL Hndl AS DWORD
LOCAL Zelo AS INTEGER
LOCAL JXB AS STRING
LOCAL JXA AS STRING
CONSOLE NAME "Hello TSU"
CONSOLE SCREEN 26, 80

Hndl = GetForegroundWindow
SendMessage Hndl, %WM_SYSCOMMAND, %SC_MAXIMIZE, 0

CALL DaBlackGround
COLOR 15: LOCATE 2,2: Print "Hello TSU"

FOR Zelo=1 TO 26
LOCATE Zelo, 76
COLOR 12,0
Print "!!";CHR$(254)
NEXT Zelo

JXB="!"

DO
JXA=INKEY$
JXA=UCASE$(JXA)
COLOR 15,0
IF JXA=CHR$(0,59) THEN JXB="@"
LOOP UNTIL (JXB="@")

END FUNCTION

SUB DaBlackGround

COLOR 0,0
LOCATE 1,1
Print STRING$(2074,32);

COLOR 14
Print CHR$(219)

END SUB

Thanx-A-Lot and Enjoy, Frank

[This message has been edited by Frank Ferrell (edited June 05, 2003).]

IP: Logged

Pierre Bellisle
Member
posted June 05, 2003 08:44 PM     Click Here to See the Profile for Pierre Bellisle     Edit/Delete Message   Reply w/Quote
Ok, let's try it this way...

#COMPILE EXE
#DIM ALL
#INCLUDE "WIN32API.INC"
'______________________________________________________________________________

FUNCTION PBMAIN() AS LONG
LOCAL Hndl AS DWORD
LOCAL Zelo AS INTEGER
LOCAL JXB AS STRING
LOCAL JXA AS STRING

CONSOLE SCREEN 26, 80
SLEEP 250 'Give window time to finish initialisation
Hndl = GetForegroundWindow 'Get console handle
SendMessage Hndl, %WM_SYSCOMMAND, %SC_MAXIMIZE, 0 '

CONSOLE NAME "Hello TSU"
CALL DaBlackGround
COLOR 15 : LOCATE 2, 2 : Print "Hello TSU"
FOR Zelo = 1 TO 26
LOCATE Zelo, 76
COLOR 12,0
Print "!!"; CHR$(254)
NEXT Zelo
JXB="!"
DO
JXA = INKEY$
JXA = UCASE$(JXA)
COLOR 15,0
IF JXA = CHR$(0,59) THEN JXB = "@"
LOOP UNTIL JXB = "@"
END FUNCTION
'______________________________________________________________________________

SUB DaBlackGround
COLOR 0, 0
LOCATE 1, 1
Print STRING$(2074, 32);
COLOR 14
Print CHR$(219)
END SUB
'______________________________________________________________________________

------------------


[This message has been edited by Pierre Bellisle (edited June 05, 2003).]

IP: Logged

Frank Ferrell
Member
posted June 05, 2003 09:02 PM     Click Here to See the Profile for Frank Ferrell     Edit/Delete Message   Reply w/Quote
Greetings --

EUREKA! -- Snooze Control -- aka Sleep 250/500 --- did the trick!

Thanks Again Pierre, Frank

[This message has been edited by Frank Ferrell (edited June 05, 2003).]

IP: Logged

Frank Ferrell
Member
posted June 11, 2003 01:55 AM     Click Here to See the Profile for Frank Ferrell     Edit/Delete Message   Reply w/Quote
Greetings --

The code that Pierre gave me works fine in Win-95 and 98 - not so well in Win-2000 and beyond. Suggestions?

------------------
Thanx-A-Lot and Enjoy, Frank

IP: Logged

Lance Edmonds
Member
posted June 11, 2003 08:11 PM     Click Here to See the Profile for Lance Edmonds     Edit/Delete Message   Reply w/Quote
PB/CC Full-screen/Windowed mode switching:
http://www.powerbasic.com/support/forums/Forum7/HTML/001941.html

------------------
Lance
PowerBASIC Support
support@powerbasic.com

IP: Logged

All times are EasternTime (US)

next newest topic | next oldest topic

Administrative Options: Close Topic | Archive/Move | Delete Topic
Post New Topic  Post A Reply
Hop to:

Contact Us | PowerBASIC BASIC Compilers

Copyright © 1999-2005 PowerBASIC, Inc. All Rights Reserved.


Ultimate Bulletin Board 5.45c