Using VpeOpenDocFile and VpeWrite method is Progress ABL.

Knowledge exchange related to the VPE Report Engine and PDF Library

Moderator: IDEAL Software Support

Using VpeOpenDocFile and VpeWrite method is Progress ABL.

Postby BartG » Thu Oct 02, 2008 1:42 am

I am trying to create a procedure in Progress that does not have a window and that uses methods from vpep3240.dll to create a report. This procedure will run on an appServer and we have found we cannot use the OCX to create the reports when running like this.

I have created the Progress procedures and seem to be able to call VpeOpenDocFile(), but I do not seem to get a handle back from it to identify the document. Here is a sample of how the Proc is created in Progress:

PROCEDURE VpeOpenDocFile EXTERNAL "c:\windows\system32\vpep3240.dll":
DEFINE INPUT PARAMETER hWindow AS CHARACTER INITIAL ? NO-UNDO. /*handle*/
DEFINE INPUT PARAMETER pReport AS CHARACTER NO-UNDO.
DEFINE INPUT PARAMETER chrTitle AS CHARACTER INITIAL "" NO-UNDO.
DEFINE INPUT PARAMETER LongFlags AS LONG NO-UNDO.
DEFINE RETURN PARAMETER hReport AS MEMPTR NO-UNDO. /*handle*/
END PROCEDURE.

Here is how it is implemented in the actual procedure:

RUN vpeOpenDocFile ("",rReport,"",0,Output MemptrVar).

The Value for "rReport" which is the document name is:
"c:\vpeReport.VPE".

I think I am getting a NULL value back as the handle for the Document Handle.

Then, When I try to write to the file using the VpeWrite(), my procedure simply hangs and does nothing.

Again, I assume that this is because I do not have a valid handle. Here is how I make the call:

RUN vpeWrite (MemptrVar,830,intY,1050,intY + 40,"Tender Cd ", OUTPUT intLastPosXY).

I get an object created on the root called "c:\vpeReport.VPE", however if I try to view it, I get this message:

Error Opening File!
Possible Reasons:
-Incompatible Document Version
-Access Denied
-File is not a VPE Document File
-File Damaged

My code never gets to the point where I can actually execute the VpeWriteDoc() and I am assuming it's because it was never created properly and written to.

I tried to put a VpeGetLastError() in after the VpeOpenDoc(), but Progress tells me that it cannot find the entry point to the DLL. Again, I assume this is because my Handle to the Document is invalid.

Am I passing in my parameters correctly to the VpeOpenDoc() method?
I pass a NULL for the Window (Parm1) , since I am not using a window and have no preview.
I pass in "C:\vpeReport.vpe" as the document I want to create.
I pass in blanks for the window title (parm 3).
I pass in a 0 for the Long Flags Parm (parm 4).

I should receive back a memory pointer with the handle, but nothing returns.

I have not yet set up a Message Call Back vpeSetMsgCallback to try to capture the error message, because I am not sure how to perform that function in Progress just yet, but I am trying to do that to capture the error message.

I know you guys aren't particularly familiar with Progress, but I mainly would like to know if I am passing in the parameters to VpeOpenDocFile incorrectly or not? I think I am doing something wrong there which would keep the Doc Handle from being created.

Can you help with that?

Thanks! - bart
BartG
 
Posts: 17
Joined: Tue Mar 18, 2008 5:06 pm
Location: Scottsdale,AZ

Postby IDEAL Software Support » Thu Oct 02, 2008 9:00 am

I have nearly no knowledge about Progress, but

DEFINE INPUT PARAMETER hWindow AS CHARACTER INITIAL ? NO-UNDO. /*handle*/


seems wrong to me, since this is a Window handle.

Please contact Progress technical support on how to call DLLs from Progress.
IDEAL Software Support
 
Posts: 1633
Joined: Thu Nov 18, 2004 4:03 pm

RE:Using VpeOpenDocFile and VpeWrite method is Progress ABL.

Postby BartG » Thu Oct 02, 2008 4:18 pm

You have misunderstood my question, it has nothing to do with the Window Handle. My question is, am I passing in the DOCUMENT name (PARM 2) correctly? Should it be something like "C:\vpeReport.vpe", with a directory path and ".vpe" appended to it, or should it be something more generic, such as just "vpeReport", which I would later pass to vpeWriteDoc to create the actual file on Disk?

Thank you,

Bart
BartG
 
Posts: 17
Joined: Tue Mar 18, 2008 5:06 pm
Location: Scottsdale,AZ

Postby IDEAL Software Support » Fri Oct 03, 2008 12:33 pm

Your primary problem is that VpeOpenDocFile() returns NULL, and I tried to figure out the reason for this. BTW, of course another reason might be that you have no access permission to the directory where you want to create the file.

The file name handling follows standard conventions. If it is without a leading path, the current working directory is used.
IDEAL Software Support
 
Posts: 1633
Joined: Thu Nov 18, 2004 4:03 pm

VPEOpenDocFile() is returning a NULL

Postby BartG » Fri Oct 03, 2008 4:14 pm

The document file is being created, however the handle is returning a NULL. I have checked with Progress Technical Support and they have verified that I am passing the parms correctly to the DLL.

Is there an easy way to find out why VPEOpenDocFile() is returning the NULL instead of a handle? I've tried using VPEGetLastError(), but this fails since I have no handle to pass to it...

How can I find out why I'm getting back a NULL?

Also, when I do try to open the document that is created on the disk, I get the following error:

Error Opening File!
Possible Reasons:
-Incompatible Document Version
-Access Denied
-File is not a VPE Document File
-File Damaged

How can I find out what is going on here????

Thanks,

Bart
BartG
 
Posts: 17
Joined: Tue Mar 18, 2008 5:06 pm
Location: Scottsdale,AZ

Postby BartG » Fri Oct 03, 2008 10:19 pm

Never mind on the last question...I found that I was not using the right type in Progress to receive back the handle. Now that I have corrected that, I am getting a Handle back.

Thanks,

Bart
BartG
 
Posts: 17
Joined: Tue Mar 18, 2008 5:06 pm
Location: Scottsdale,AZ


Return to VPE Open Forum

Who is online

Users browsing this forum: No registered users and 5 guests

cron