Not sure what's wrong...
Posted: Mon Aug 19, 2019 1:24 am
Hi again,
I'm calling a report (ReportPro 2.30a) Like this:
METHOD FPJobNoReport(cClientHeader, nJobNo) CLASS DataWindow
LOCAL oReport as RpReport
LOCAL cJobName,cPrint2Filename,cCaption,cMessage as STRING
oReport := RpReport{ self, "JobNumber.RPT" }
IF oReport:IsValid
cJobName := "Job Report"
cPrint2Filename := "REPORT.PRN"
cCaption := cAppVersion + " : Report Preview"
cMessage := "Printing in progress..."
oReport:SetVariableValue("ClientHeading", cClientHeader)
oReport:SetVariableValue("nJobNo", nJobNo)
oReport:FilterExpression := "Details.JobNumber == nJobNo"
oReport:PrintPreview(cJobName,cPrint2Filename,cCaption,cMessage,,SW_SHOWMAXIMIZED)
ENDIF
oReport:Close()
return self
If I run it as is from a button it works fine. BUT if EITHER of these run before it, it says that "JobNumber.rpt" cannot be opened.
//ShellExecute(null, String2Psz("open"), String2Psz(cFile), null, String2Psz(cFile), SW_SHOW)
self:SpawnApp(cFile)
Here's the actual error:
SpawnApp, I nicked from someone in the old NG to solve another problem I had:
METHOD SpawnApp( cMySpawnedApp ) CLASS ReportsMenu
LOCAL lpShellInfo is _winShellExecuteInfo
LOCAL hProc as ptr
LOCAL lpExitCode as DWORD
LOCAL lRunning as LOGIC
lpShellInfo.cbSize := _sizeof( _winSHELLEXECUTEINFO )
lpShellInfo.hwnd := self:Owner:Handle()
// Shell Window
lpShellInfo.lpVerb := String2Psz("open")
lpShellInfo.lpFile := String2Psz( cMySpawnedApp )
// This can be an associated document/data file
lpShellInfo.nShow := SW_ShowNormal
lpShellInfo.fMask := SEE_MASK_NOCLOSEPROCESS
IF ShellExecuteEx( @lpShellInfo )
hProc := lpShellInfo.hProcess
GetExitCodeProcess( hProc, @lpExitCode )
lRunning := ( lpExitCode == STILL_ACTIVE )
WHILE lRunning
GetExitCodeProcess( hProc, @lpExitCode )
lRunning := ( lpExitCode == STILL_ACTIVE )
end do
self:EndWindow()
end
Return nil
I don't see the correlation between opening a PDF (which the Spawn Method does) and opening an RPT file. I've checked the paths, both are correct.. What am I missing please?
I'm calling a report (ReportPro 2.30a) Like this:
METHOD FPJobNoReport(cClientHeader, nJobNo) CLASS DataWindow
LOCAL oReport as RpReport
LOCAL cJobName,cPrint2Filename,cCaption,cMessage as STRING
oReport := RpReport{ self, "JobNumber.RPT" }
IF oReport:IsValid
cJobName := "Job Report"
cPrint2Filename := "REPORT.PRN"
cCaption := cAppVersion + " : Report Preview"
cMessage := "Printing in progress..."
oReport:SetVariableValue("ClientHeading", cClientHeader)
oReport:SetVariableValue("nJobNo", nJobNo)
oReport:FilterExpression := "Details.JobNumber == nJobNo"
oReport:PrintPreview(cJobName,cPrint2Filename,cCaption,cMessage,,SW_SHOWMAXIMIZED)
ENDIF
oReport:Close()
return self
If I run it as is from a button it works fine. BUT if EITHER of these run before it, it says that "JobNumber.rpt" cannot be opened.
//ShellExecute(null, String2Psz("open"), String2Psz(cFile), null, String2Psz(cFile), SW_SHOW)
self:SpawnApp(cFile)
Here's the actual error:
SpawnApp, I nicked from someone in the old NG to solve another problem I had:
METHOD SpawnApp( cMySpawnedApp ) CLASS ReportsMenu
LOCAL lpShellInfo is _winShellExecuteInfo
LOCAL hProc as ptr
LOCAL lpExitCode as DWORD
LOCAL lRunning as LOGIC
lpShellInfo.cbSize := _sizeof( _winSHELLEXECUTEINFO )
lpShellInfo.hwnd := self:Owner:Handle()
// Shell Window
lpShellInfo.lpVerb := String2Psz("open")
lpShellInfo.lpFile := String2Psz( cMySpawnedApp )
// This can be an associated document/data file
lpShellInfo.nShow := SW_ShowNormal
lpShellInfo.fMask := SEE_MASK_NOCLOSEPROCESS
IF ShellExecuteEx( @lpShellInfo )
hProc := lpShellInfo.hProcess
GetExitCodeProcess( hProc, @lpExitCode )
lRunning := ( lpExitCode == STILL_ACTIVE )
WHILE lRunning
GetExitCodeProcess( hProc, @lpExitCode )
lRunning := ( lpExitCode == STILL_ACTIVE )
end do
self:EndWindow()
end
Return nil
I don't see the correlation between opening a PDF (which the Spawn Method does) and opening an RPT file. I've checked the paths, both are correct.. What am I missing please?