Post by Larry on Apr 12, 2019 15:06:59 GMT -5
This code I am having trouble with on my windows machine, and I know it's something stupid I've done but it stays in memory after I click the X and I have to go to the task manager and end task to clear it out. I found and isolated one spot where I thought it might be doing it and fixed that bug, and it didn't do it again the next time I ran it so I thought it was fixed, but then it showed up again later.
'Form created with the help of Freeform 3 v07-15-08
'Generated on Dec 21, 2011 at 23:28:20
'This code produces a Book Writing program
' It is password enabled and is in comic sans font.
' It is in this carb log program as an add on feature so you
' can journal your feelings as you try to get to a more healthy
' you
called$=""
dim pdw$(300),chaptitle$(300)
fnt=0
mode$="normal"
oldfile$=""
romode$="Editable"
smode$="off"
espmode$="cap"
revon$="no"
seclevel$=""
showesp$="yes"
majorversion=3
minorversion=1
saved$="no"
loaded$="no"
wintitle$="Larry's Book Writer V"+trim$(str$(majorversion))+"."+trim$(str$(minorversion))
reopen$="no"
chapter=1:chapter$=str$(chapter)
qlmode=0
crlf$=chr$(13)+chr$(10)
mode=1
ttlchapters=1
chaptitle$(chapter)=""
if filename$="" then filename$="f:\book writer\data\untitled.bkwr"
[setup.journal.Window]
'-----Begin code for #journal
nomainwin
WindowWidth = 1290
WindowHeight = 720
UpperLeftX=int((DisplayWidth-WindowWidth)/2)
UpperLeftY=int((DisplayHeight-WindowHeight)/2)
'-----Begin GUI objects code
TextboxColor$="buttonface"
ForegroundColor$ = "darkblue"
texteditor #journal.ted,15, 5, 980, 625
stylebits #journal.ted, 0,_ES_AUTOHSCROLL or _WS_HSCROLL,0,0
button #journal.b1,"New Book Writer File",[b1.journal],UL,1030,5,330,35
button #journal.b2,"Open Book Writer File",[b2.journal],UL,1030,50,330,35
button #journal.b3,"Save Book Writer File",[b3.journal],UL,1030,100,330,35
button #journal.b4,"Save Book Writer File As",[b4.journal],UL,1030,150,330,35
stylebits #journal, _WS_MAXIMIZE, 0, 0, 0
statictext #journal.filename,filename$,5,630,800,35
statictext #journal.heading,"Chapter",1140,250,230,35
statictext #journal.chaptitle,chaptitle$(chapter),1030,300,430,35
button #journal.prevchap," <--",[prevchap.journal],UL,1030,350,60,35
statictext #journal.chapter,chapter$,1190,350,30,35
button #journal.nextchap,"--> ",[nextchap.journal],UL,1300,350,60,35
'-----End GUI objects code
'-----Begin menu code
menu #journal, "Edit" ' <-- Texteditor menu.
menu #journal, "Date and time", "Insert Date and time",[datetime.journal]
'-----End menu code
open wintitle$ for window as #journal
print #journal, "font Comic_sans_MS 20"
print #journal.ted, "!font Comic_sans_MS 20"
print #journal.filename, "!font Comic_sans_MS 20"
print #journal, "trapclose [quit.journal]"
wait
[b1.journal] 'new file - clears the text editor
for i=1 to 300:pdw$(i)="":chaptitle$(i)="":next i
mode$="normal"
#journal.ted,"!cls"
enc$="":dec$=""
w$=""
chapter=1
chapter$=str$(chapter)
print #journal.ted, "!font Comic_sans MS 20"
filename$="f:\book writer\data\untitled.bkwr"
#journal.filename,filename$
#journal.chapter,chapter$
#journal.chaptitle,chaptitle$(chapter)
#journal.ted,"!SetFocus"
wait
[b2.journal] 'open file - loads in a new file
#journal.b2,"!disable"
oldfilename$=filename$
filedialog "Open Book Writer file", "f:\book writer\data\*.bkwr", filename$
if filename$="" then filename$=oldfilename$:#journal.b2,"!enable":wait
[load]
gosub [pw]
#journal.ted,"!cls"
chapter=1
chapter$=str$(chapter)
#journal.chapter,chapter$
x=1
open filename$ for input as #load
while eof(#load)=0
line input #load,temp$
if left$(temp$,1)="[" and right$(temp$,1)="]" then chaptitle$(x)=mid$(temp$,2,len(temp$)-2)
if temp$<>"`" and left$(temp$,1)<>"[" and right$(temp$,1)<>"]"then pdw$(x)=pdw$(x)+temp$+chr$(13)
if temp$="`" then x=x+1
wend
close #load
ttlchapters=x
#journal.ted,"!cls"
#journal.ted,pdw$(chapter)
#journal.filename,filename$
#journal.b2,"!enable"
#journal.chapter,chapter$
#journal.chaptitle,chaptitle$(chapter)
#journal.ted,"!SetFocus"
loaded$="yes"
wait
[b3.journal] 'save file - saves the file
if filename$="" then #journal.b3,"!enable":goto [b4.journal]
#journal.b3,"!disable"
print #journal.ted, "!contents? test$";
pdw$(chapter)=test$
open filename$ for output as #save
for i=1 to ttlchapters-1
if chaptitle$(i)<>"" then print #save,chaptitle$(i)
print #save,pdw$(i)
print #save,"`"
next i
print #save,pdw$(ttlchapters)
close #save
gosub [ModalWindow1]
#journal.b3,"!enable"
#journal.chapter,chapter$
#journal.chaptitle,chaptitle$(chapter)
#journal.ted,"!SetFocus"
wait
[b4.journal] 'save file - saves the file as
#journal.b4,"!disable"
filedialog "Save Book Writer file as", "f:\book writer\data\*.bkwr", filename$
if filename$="" then #journal.b4,"!enable":wait
if right$(filename$,5)<>".bkwr" then filename$=filename$+".bkwr"
enc$="":pdw$=""
print #journal.ted, "!contents? test$";
pdw$(chapter)=test$
open filename$ for output as #save
for i=1 to ttlchapters-1
if chaptitle$(i)<>"" then print #save,chaptitle$(i)
print #save,pdw$(i)
print #save,"`"
next i
print #save,pdw$(ttlchapters)
close #save
gosub [ModalWindow1]
#journal.b4,"!enable"
#journal.filename,filename$
#journal.chapter,chapter$
#journal.chaptitle,chaptitle$(chapter)
#journal.ted,"!SetFocus"
wait
[datetime.journal]
d$=date$()
t$=time$()
h$=left$(t$,2)
if h$>"12" then ampm$="Pm"
if h$<"12" then ampm$="Am"
if h$>"12" then h$=str$(val(h$)-12)
m$=mid$(t$,4,2)
t$=h$+":"+m$+" "+ampm$
d$=d$+" "+t$
#journal.ted,"!insert d$";
gosub [virtcalkey]
#journal.ted,"!SetFocus"
wait
[pw]
'Form created with the help of Freeform 3 v07-15-08
'Generated on Jan 09, 2012 at 18:25:14
[setup.pw.Window]
'-----Begin code for #pw
WindowWidth = 1290
WindowHeight = 720
UpperLeftX=int((DisplayWidth-WindowWidth)/2)
UpperLeftY=int((DisplayHeight-WindowHeight)/2)
'-----Begin GUI objects code
TextedoxColor$ = "white"
stylebits #pw.ted1, _ES_PASSWORD, _ES_AUTOVSCROLL or _ES_MULTILINE, 0, 0
textbox #pw.ted1, 120, 37, 615, 95
button #pw.default,"",[ok.pw], UL, 355, 160, 106, 95
stylebits #pw, _WS_MAXIMIZE, 0, 0, 0
'-----End GUI objects code
open "Please enter the password" for window as #pw
print #pw, "font ariel_sudeuro 16"
#pw.ted1,"!font ariel_sudeuro 40"
#pw.default,"!font ariel_sudeuro 40"
#pw.default,"Ok"
#pw.ted1,"!setfocus"
wait
[ok.pw]
#pw.ted1,"!contents? pw$";
if pw$="" then notice "You must put in a password. If you just got the program, and do not know it, just enter anything. The Password is only for the sensitive data you might not want others to see.":#pw.ted1,"!setfocus":wait
if pw$="06151964" then close #pw:return
if pw$="1964" then close #pw:return
if pw$="!(^$" then close #pw:return
if pw$<>"06151964" and pw$<>"1964" and pw$<>"!(^$" then close #pw:wait
wait
[prevchap.journal]
if chapter=1 then wait
chapter=chapter-1
chapter$=str$(chapter)
#journal.chapter,chapter$
#journal.ted,"!cls"
#journal.ted,pdw$(chapter)
#journal.chaptitle,chaptitle$(chapter)
wait
[nextchap.journal]
if chapter=300 then wait
chapter=chapter+1
chapter$=str$(chapter)
#journal.chapter,chapter$
#journal.chaptitle,chaptitle$(chapter)
#journal.ted,"!cls"
#journal.ted,pdw$(chapter)
wait
[quit.journal]
close #journal
wait
[ModalWindow1]
WindowWidth=320:WindowHeight=120
stylebits #w, _DS_CENTER,0,0,0 'center the window
BackgroundColor$="lightgray":ForegroundColor$="blue"
txt$="The File Has Been Saved!!!"
statictext #w.st1,txt$,10,10,400,25
button #w.ok,"Ok",[yes],ul,120,50,80,25
open "" for dialog_modal as #w
#w,"trapclose [no]"
#w,"font Comic_sans MS 18"
#w.st1,"!font Comic_sans MS 18"
wait
[yes]
close #w
return
[no]
wait
[virtcalkey]
keypress7=37 'arrow left
CallDLL #user32,"keybd_event",keypress7 as long,0 as long,0 as long,r as void
CallDLL #user32,"keybd_event",keypress7 as long,0 as long,2 as long,r as void
keypress7=39 'arrow right
CallDLL #user32,"keybd_event",keypress7 as long,0 as long,0 as long,r as void
CallDLL #user32,"keybd_event",keypress7 as long,0 as long,2 as long,r as void
return