home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
BUG 4
/
BUGCD1997_05.BIN
/
aplic
/
clip4win
/
clip4win.exe
/
C4W30E.HUF
/
SOURCE
/
WINWRD.PRG
< prev
next >
Wrap
Text File
|
1995-10-12
|
1KB
|
68 lines
#include "windows.ch"
function main_wword()
local hWnd := WinSetup("test", "test")
local hServer
hServer = DDEStart(hWnd, "WINWORD", "System")
if empty(hServer) .and. !RunWinWord()
quit
endif
hServer = DDEStart(hWnd, "WINWORD", "System")
if empty(hServer)
quit
endif
// NOTE: *** This assumes the file to print is TEST.DOC ***
//
// open, print & close - note the embedded quotes (")
DDEExecute(hServer, hWnd, '[FileOpen("test.doc")][FilePrint()][FileExit(2)]',;
.f.)
DDEStop(hServer, hWnd)
return 0
function RunWinWord() // --> .t. if started ok
local hModule, cDir, cFile, cWordDir, cDoc
// try a simple RUN
hModule = WinExec("WINWORD.EXE", SW_SHOWMINNOACTIVE)
if hModule >= 32
return .t.
endif
// didn't run, start hunting for it...
// try WINWORD6.INI, if it exists
cDir = GetWindowsDirectory()
if file(cFile := (cDir + "\WINWORD6.INI"))
cWordDir = GetPvProfString("Microsoft Word", "PROGRAMDIR", "", cFile)
if !empty(cWordDir)
hModule = WinExec(cWordDir + "\WINWORD.EXE", SW_SHOWMINNOACTIVE)
if hModule >= 32
return .t.
endif
endif
endif
// try [Extensions] in WIN.INI
cDoc = GetProfString("Extensions", "doc", "")
cDoc = left(cDoc + " ", at(" ", cDoc) - 1) // remove " ^.doc" if there
if !empty(cDoc)
hModule = WinExec(cDoc, SW_SHOWMINNOACTIVE)
if hModule >= 32
return .t.
endif
endif
return .f. // failed