Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error 1958 w/ object assisted repo form + no printer

Status
Not open for further replies.

oakgrove

Programmer
Sep 22, 2002
51
0
0
US
This msdn link:


says that object assisted printing will fail if there is no printer installed or the print spooler is not started in the executing environment. It suggests that getpageheight() and getpagewidth() can be used to give VFP enough information to prevent the "Error loading printer driver (Error 1958)" which occurs when trying to execute the REPORT FORM ... command.

Can anybody show me how to modify the following exe to accomplish this? ( The exe passes the string up to a mtdll and then to an asp page.)
Code:
Define Class getregexe As Custom OlePublic
...code to build the print cursor
Do (_reportOutput) With 5, loListener
loListener.quietmode = .t.
Report Form budget.frx Object loListener
lc=FiletoStr(loListener.targetfilename)
... code to send lc to the asp page

enddefine
Thanks for any help.

Oakgrove Computer Grouper
Lansing, MI
 
Hi Oakgrove,

Have you been able to resolve this? I guess I'm feeling bad that no one's replied to your question yet. :( Maybe it's cuz not many have used the new object-assisted reporting in VFP9. Actually, we don't even have VFP9 yet. So, despite risking complete and utter embarrassment by telling you something you already know.... have you tried plain old error trapping? Plain old error trapping example:

Code:
lcSaveErr = ON("ERROR")
ON ERROR lcErrMsg = MESSAGE()
lcErrMsg = ""
.
.
Report Form budget.frx Object loListener
ON ERROR &lcSaveErr

IF EMPTY(lcErrMsg)
   lc=FiletoStr(loListener.targetfilename)
ELSE
   lc="ERROR: Unable to complete report request...."
   * and attach actual error message in lcErrMsg
ENDIF
 
I just got this whole thing to work about an hour ago.

I had to sub class _reportlistener.htmllistener so that I could use getpageheight() and getpagewidth() to set these two values which satisfied VFP runtime even though there was no printer defined on the web server. See MSDN


Then I had to use the following approach to instantiate the object assisted printing so my subclass would be used
Code:
    ... create the report cursor
    lctheoutput=""
    loListener = .null.
    Set Classlib To noprinthtmllistener.vcx Additive
    loListener = Createobject("noprinthtmllistener")
    loListener.Quietmode = .T.
    Report Form regionbudget.frx Object loListener
    lctheoutput=Filetostr(loListener.targetfilename)
    Return lctheoutput && to the calling dll then asp

Other items:
1. Since this is all being called from an asp page I had to give iusr_machinename read/write permissions for several folders.
2. I had to include a copy of outputconfig.dbf in the exe project so _reportlistener would stop trying to create it in the windoes/system32 folder.
3. I had to place a copy of the frx and frt files in a directory that the _reportlistener was looking for. (I don't know why).

It is actually very slick now that it is working. Once I make sure this is working totally I will try and post how to do it in more detail if anybody is interested.

Oakgrove Computer Grouper
Lansing, MI
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top