home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
BUG 4
/
BUGCD1997_05.BIN
/
aplic
/
clip4win
/
clip4win.exe
/
C4W30E.HUF
/
SOURCE
/
RRWREP.PRG
< prev
next >
Wrap
Text File
|
1995-05-04
|
3KB
|
113 lines
/////////////////////////
//
// rrwrep.prg - Demo of R & R Report Writer Xbase version 6.0
//
// Copyright (C) 1995 Skelton Software, Kendal Cottage, Hillam, Leeds LS25 5HP, UK.
// All Rights Reserved.
//
// Note: You need rrwapi.prg as well.
//
/////////////////////////
#define WIN_WANT_ALL
#include "windows.ch"
#include "vo.ch"
#define NO_C4WCLASS
#include "commands.ch"
function main()
local oApp, hWnd
CREATE APPLICATION oApp ;
WINDOW hWnd ;
TITLE "Clip-4-Win Using R & R for Windows" ;
ON INIT MenuSetup(hWnd)
return nil
static function MenuSetup(hWnd)
MENU in hWnd
POPUP "&File"
MENUITEM "&Run R && R Reports" ACTION RRTest(hWnd)
MENUITEM SEPARATOR
MENUITEM "E&xit" ACTION PostQuitMessage(0)
ENDPOPUP
ENDMENU
return nil
// Many thanks to Rick Spence for donating the original of this code!
static function RRTest(hWnd)
LOCAL lResult AS LOGIC
LOCAL hReport AS SHORT
LOCAL ptrRepName AS PTR
LOCAL pszErrorMsg AS PTR
LOCAL ptrCode AS PTR
LOCAL ptrReport AS PTR
LOCAL ptrEcode AS PTR
LOCAL ptrPageCount AS PTR
LOCAL ptrEMsg AS PTR
LOCAL hRR
hRR := LoadLibrary("RReport.dll")
// R & R seems to need a ptr to a NULL string. Allocate one byte
// and set it to 0
ptrRepName := chr(0)
lResult := InitRunTimeInstance()
hReport := ChooseReport("RRTEST", ;
"I:\rrw\rrsample\rrsample.rp5", ;
ptrRepName, 1)
IF hReport == 0
MessageBox( , "Received Error", "R&R Error")
ptrEMsg := MemAlloc(200)
ptrECode := MemAlloc(2) // INT
GetErrorInfo(@ptrEMsg, len(ptrEMsg), @ptrECode)
MessageBox( , ptrEMsg, "R&R GetErrorInfo Msg")
MessageBox( , left(ptrECode, 1), "R&R GetErrorInfo Code")
ELSE
// My window now becomes R & R's parent
SetWinParentHandle(hReport, hWnd)
// Put up a query box
SetFilterUsage(hReport, ASC("?"))
// We want to see messages
SetDisplayStatus(hReport, TRUE)
// Ask user to select destination
SetOutputDest(hReport,ASC("?"))
// Allocate memory for ExecRuntime()'s pointers
ptrECode := MemAlloc(2) // INT
ptrPageCount := MemAlloc(4) // LONG
ptrEMsg := MemAlloc(200) // The message
lResult := ExecRuntime(;
hReport,; // hReport AS SHORT
TRUE,; // bWait AS LOGIC
SW_SHOWNORMAL,; // cmdShow AS SHORT
@ptrECode,; // ECode AS PTR
@ptrPageCount,; // PageCount AS PTR
@ptrEMsg,; // EMsg AS PTR
200; // EMSize AS SHORT
) // end of call
EndReport(hReport)
MemFree(ptrECode)
MemFree(ptrPageCount)
MemFree(ptrEMsg)
ENDIF
EndRuntimeInstance()
SetFocus(hWnd)
FreeLibrary(hRR)
RETURN nil