On Tue, 11 Nov 2008 17:21:51 -0500 Ivan Benttini
Sender: "Ivan Benttini" <***@nc.rr.com>
wrote the following in:
Newsgroup: dbase.programming
Post by Ivan BenttiniThanks Ivar,
Is there a simple way to see it on the screen, like I see it in the command
window that you can share with me?
Save the code below my signature as indicated and run.
Is this what you have in mind?
Ivar B. Jessen
//----- Save as getTextFile.wfm -----
** END HEADER -- do not remove this line
//
// Generated on 12-11-2008
//
parameter bModal
local f
f = new getTextFileForm()
if (bModal)
f.mdi = false // ensure not MDI
f.readModal()
else
f.open()
endif
class getTextFileForm of FORM
with (this)
height = 13.5
left = 43.5714
top = 1.1818
width = 66.2857
text = ""
endwith
this.EDITOR1 = new EDITOR(this)
with (this.EDITOR1)
height = 9.5
left = 4.0
top = 1.0
width = 59.0
value = ""
endwith
this.GETFILE = new PUSHBUTTON(this)
with (this.GETFILE)
onClick = class::GETFILE_ONCLICK
height = 1.0909
left = 4.0
top = 11.5
width = 15.2857
text = "Get textfile"
endwith
this.PRINTFILE = new PUSHBUTTON(this)
with (this.PRINTFILE)
onClick = class::PRINTFILE_ONCLICK
height = 1.0909
left = 21.0
top = 11.5
width = 15.2857
text = "Print"
endwith
function GETFILE_onClick
form.editor1.value = ""
form.fileName = getFile(_dbwinhome + "*.txt", "Chose text File",TRUE)
if empty(form.fileName)
return null
endif
f = new file()
f.open(form.fileName, "R")
form.cStr = f.read(f.size(form.fileName))
f.close()
form.editor1.value = form.cStr
return
function PRINTFILE_onClick
#include Winuser.h
#define WINAPI_A "A"
#define WINAPI_SHELL "SHELL32"
extern cHandle ShellExecute( cHandle, cString, cString, ;
cString, cString, cINT ) WINAPI_SHELL ;
from "ShellExecute" + WINAPI_A
_app.printer.chooseprinter()
ShellExecute(_app.Framewin.hwnd, "print", ;
form.filename, null, null, SW_HIDE)
return
endclass
//-----