Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Windows generator

MaramoundMaramound Posts: 2Member
I just finished a cool program that "draws" Windows quality windows in QB. You simply enter the desired coordinates and the program will spit out the required code to a file. Give it a try! The QB code is here, and a compiled version (.EXE) is available here:

http://www.angelfire.com/wizard/tlomc/winmaker.exe

Here is the actual code: (copy and paste to notepad)

' *** 3d Window Code Maker ***
'
' This program takes (1x,1y)-(2x,2y) coordinates from the user and
' generates QB code to draw a Microsoft Windows quality window in QB.
' OUTPUTFILE$ is where the code is written to.
' backgroundcolor% uses the standard QB color commands:
' 0 = Black 1 = Dark Blue 2 = Green 3 = Light Blue 4 = Red
' 5 = Pink 6 = Orange 7 = Grey Etc...
' Make sure 1x,1y are SMALLER values than 2x,2y or the window
' looks all weird-like. To change the outputted code, simply
' edit the bottom of THIS program where you see all of the
' "PRINT #1" commands. Have fun!
' *** Programmed by: Douglas Landmesser -- 16 October 2003 -- ***

loopsequence:
SCREEN 0
COLOR 7,0
CLS
LOCATE 1,1,0
PRINT " 3d Window Maker: "
PRINT ""
INPUT "Enter top X coordinate (6 minimum, border = 6 lines)............" , topx%
INPUT "Enter top Y coordinate (6 minimum, border = 6 lines)............" , topy%
INPUT "Enter bottom X coordinate (633 maximum, screen ends 639)........" , bottomx%
INPUT "Enter bottom Y coordinate (473 maximum, screen ends 479)........" , bottomy%
INPUT "Enter background color (Grey looks weird, window IS correct)....", backgroundcolor%
INPUT "Enter FULL pathfilename for output (ex: C:TESTBOX.BAS)........" , OUTPUTFILE$
1 SCREEN 12
LINE (0,0)-(639,479),1,BF
DELAY 1 ' <--- Might be "SLEEP 1" for QB versions.
LINE (topx%,topy%)-(bottomx%,bottomy%),backgroundcolor%,BF
LINE (bottomx%+6,bottomy%+6)-(bottomx%+6,topy%-6),0
LINE (bottomx%+6,bottomy%+6)-(topx%-6,bottomy%+6),0
LINE (topx%-6,bottomy%+6)-(topx%-6,topy%-6),7
LINE (topx%-6,topy%-6)-(bottomx%+6,topy%-6),7
LINE (bottomx%+5,bottomy%+5)-(bottomx%+5,topy%-5),8
LINE (bottomx%+5,bottomy%+5)-(topx%-5,bottomy%+5),8
LINE (topx%-5,bottomy%+5)-(topx%-5,topy%-5),15
LINE (topx%-5,topy%-5)-(bottomx%+5,topy%-5),15
LINE (topx%-4,topy%-4)-(bottomx%+4,bottomy%+4),7,B
LINE (topx%-3,topy%-3)-(bottomx%+3,bottomy%+3),7,B
LINE (topx%-2,topy%-2)-(bottomx%+1,topy%-2),8
LINE (topx%-2,topy%-2)-(topx%-2,bottomy%+1),8
LINE (bottomx%+2,topy%-2)-(bottomx%+2,bottomy%+2),15
LINE (bottomx%+2,bottomy%+2)-(topx%-2,bottomy%+2),15
LINE (topx%-1,topy%-1)-(bottomx%,topy%-1),0
LINE (topx%-1,topy%-1)-(topx%-1,bottomy%),0
LINE (topx%-1,bottomy%+1)-(bottomx%+1,bottomy%+1),7
LINE (bottomx%+1,bottomy%+1)-(bottomx%+1,topy%-1),7

LOCATE 1,1,0
PRINT " Writing code to file ";outputfile$;"..."
OPEN outputfile$ FOR OUTPUT AS #1
PRINT #1, "SCREEN 12 'remove this to stop CLS"
PRINT #1, "LINE (0,0)-(639,479),1,BF 'remove this to stop blue screen"
PRINT #1, "topx% ="; topx%
PRINT #1, "topy% ="; topy%
PRINT #1, "bottomx% ="; bottomx%
PRINT #1, "bottomy% ="; bottomy%
PRINT #1, "backgroundcolor% ="; backgroundcolor%
PRINT #1, "LINE (topx%,topy%)-(bottomx%,bottomy%),backgroundcolor%,BF"
PRINT #1, "LINE (bottomx%+6,bottomy%+6)-(bottomx%+6,topy%-6),0"
PRINT #1, "LINE (bottomx%+6,bottomy%+6)-(topx%-6,bottomy%+6),0"
PRINT #1, "LINE (topx%-6,bottomy%+6)-(topx%-6,topy%-6),7"
PRINT #1, "LINE (topx%-6,topy%-6)-(bottomx%+6,topy%-6),7"
PRINT #1, "LINE (bottomx%+5,bottomy%+5)-(bottomx%+5,topy%-5),8"
PRINT #1, "LINE (bottomx%+5,bottomy%+5)-(topx%-5,bottomy%+5),8"
PRINT #1, "LINE (topx%-5,bottomy%+5)-(topx%-5,topy%-5),15"
PRINT #1, "LINE (topx%-5,topy%-5)-(bottomx%+5,topy%-5),15"
PRINT #1, "LINE (topx%-4,topy%-4)-(bottomx%+4,bottomy%+4),7,B"
PRINT #1, "LINE (topx%-3,topy%-3)-(bottomx%+3,bottomy%+3),7,B"
PRINT #1, "LINE (topx%-2,topy%-2)-(bottomx%+1,topy%-2),8"
PRINT #1, "LINE (topx%-2,topy%-2)-(topx%-2,bottomy%+1),8"
PRINT #1, "LINE (bottomx%+2,topy%-2)-(bottomx%+2,bottomy%+2),15"
PRINT #1, "LINE (bottomx%+2,bottomy%+2)-(topx%-2,bottomy%+2),15"
PRINT #1, "LINE (topx%-1,topy%-1)-(bottomx%,topy%-1),0"
PRINT #1, "LINE (topx%-1,topy%-1)-(topx%-1,bottomy%),0"
PRINT #1, "LINE (topx%-1,bottomy%+1)-(bottomx%+1,bottomy%+1),7"
PRINT #1, "LINE (bottomx%+1,bottomy%+1)-(bottomx%+1,topy%-1),7"
PRINT #1, ""
PRINT #1, "' Simply insert code into existing program!"
CLOSE #1
PRINT " File completed! "
PRINT ""
INPUT " Create another [Y/N]? " , another$
IF another$ = "Y" THEN GOTO loopsequence:
IF another$ = "y" THEN GOTO loopsequence:
IF another$ = "YES" THEN GOTO loopsequence:
IF another$ = "yes" THEN GOTO loopsequence:
CLS
LOCATE 10,10,0
PRINT "Goodbye!"
END

I hope this helps all of you GUI makers out there.

Doug :-)

Sign In or Register to comment.