Another VPEOpenDocFile() and VPEWrite() question...

Knowledge exchange related to the VPE Report Engine and PDF Library

Moderator: IDEAL Software Support

Another VPEOpenDocFile() and VPEWrite() question...

Postby BartG » Mon Oct 06, 2008 10:28 pm

Using PROGRESS, I am now able to call the DLL method VPEOpenDocFile(), and get back a value in the RETURNS parameter VpeHandle. This handle returns to me as a 32 bit integer and I get a .VPE document created on the disk.

The problem now is that if I try to pass that handle (hDocHdl) to my next method, say VPEWrite(), VPEGetErrorMsg(), VPECloseDoc(), or anything else, all my system does is hang-up and not perform the requested VPE task.

I have to assume that I am not passing the handle I have received back from VPEOpenDocFile() correctly to the VPE function I am calling to work on my document. Like I said, I receive this value back as an integer value (which I should according to the VPE DLL manual).

What is the datatype supposed to be for vpeHandle hDoc when I try to call the VPEWrite() method?

In Progress, I have to call the method as if it were a procedure, I have to define the parameters and then pass them when I make the call:

THis is how I define VPEOpenDocFile():

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

hDocHdl is the field that will receive the HANDLE to the object.

Here is how I make the call to VpeOpenDocFile():

ASSIGN rReport = "c:\vpeTestRpt.vpe". /* name the document*/
RUN vpeOpenDocFile (0,rReport,"",VPE_FIXED_MESSAGES,Output hDocHdl).

I get the HANDLE value back just fine (hDocHdl).

Now, here is how I define VpeWrite():

PROCEDURE VpeWrite EXTERNAL "c:\windows\system32\vpep3240.dll":
DEFINE INPUT PARAMETER hReport AS LONG NO-UNDO. /*handle */
DEFINE INPUT PARAMETER intPOSX AS LONG NO-UNDO. /*int*/
DEFINE INPUT PARAMETER intPOSY AS LONG NO-UNDO. /*int*/
DEFINE INPUT PARAMETER intPOSX2 AS LONG NO-UNDO. /*int*/
DEFINE INPUT PARAMETER intPOSY2 AS LONG NO-UNDO. /*int*/
DEFINE INPUT PARAMETER chrTEXT AS CHARACTER NO-UNDO.
DEFINE RETURN PARAMETER intLastPOS AS LONG NO-UNDO. /*int*/
END PROCEDURE.

And here is how I call VpeWrite():

RUN vpeWrite (hDocHdl,830,intY,1050,intY + 40,"Hello World", OUTPUT intLastPosXY).

Notice that I used the hDocHdl that I received back from VPEOpenDocFile(). When I do this, nothing happens...my procedure goes out to VPEWrite(), but never returns.

Once again, the main question is, what should my datatype be for hDocHdl when I call VPEWrite()? SHould it be defined as a LONG (integer)? Any other hints or help is appreciated as well!

I have contacted Progress and they have said that as far as they can tell, I have defined all my parameters correctly as far as the types that Progress can work with, etc.

Thanks,

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

Postby IDEAL Software Support » Tue Oct 07, 2008 1:01 pm

What version of VPE are you using?
IDEAL Software Support
 
Posts: 1633
Joined: Thu Nov 18, 2004 4:03 pm

Postby BartG » Tue Oct 07, 2008 4:09 pm

I am using v4.0 for this. We also have v3.6 installed, but we are trying to upgrade all of our modules and convert to an appserver application. The dll I am trying to use is vpep3240.dll.

Thanks,

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

stack trace...

Postby BartG » Tue Oct 07, 2008 10:35 pm

I don't know if this will help or not, but this is the stack trace generated when trying to use vpeWrite() and vpeWriteDoc():

vpeWrite() generates this stack trace:
Exception code: C0000005 ACCESS_VIOLATION
Fault address: 050BABE2 01:00029BE2 c:\windows\system32\vpep3240.dll

Registers:
EAX:00000000
EBX:013DC3F8
ECX:013DC528
EDX:00000000
ESI:00000000
EDI:013DC358
CS:EIP:001B:050BABE2
SS:ESP:0023:0012FC00 EBP:0012FBF8
DS:0023 ES:0023 FS:003B GS:0000
Flags:00010202

Call Stack:
Address Frame
050BABE2 0012FBF8 VpePurgeFontSubstitution+3822

vpeWriteDoc() generates this stacktrace:
Exception code: C0000005 ACCESS_VIOLATION
Fault address: 05022B8A 01:00021B8A c:\windows\system32\vpep3240.dll

Registers:
EAX:0149F06C
EBX:0149F06C
ECX:00000003
EDX:00000000
ESI:00000000
EDI:021FC358
CS:EIP:001B:05022B8A
SS:ESP:0023:0012FDB4 EBP:0012FC00
DS:0023 ES:0023 FS:003B GS:0000
Flags:00010212

Call Stack:
Address Frame
05022B8A 0012FC00 VpeSetAutoBreak+8BA
05022C85 0012FDAC VpeWriteDoc+15
1024C375 0160D4E4 pam_get_item+634B5

I understand that C0000005 is an access violation, but what kind? What is it saying? Is it unable to find the document because of something wrong with the handle?

Do you have any other clients using Progress that might be using the DLL? If so, could you help me get in touch with them to see if they might have any suggestions on what is happening and how to overcome it?

Thanks,

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

Postby IDEAL Software Support » Wed Oct 08, 2008 12:16 pm

Once again, the main question is, what should my datatype be for hDocHdl when I call VPEWrite()? SHould it be defined as a LONG (integer)? Any other hints or help is appreciated as well!


On 32-bit platforms it must be a 32-bit integer, on 64-bit platforms (when VPE is compiled and running as 64-bit binary) it must be a 64-bit integer.

C0000005 ACCESS_VIOLATION means that memory is addressed, which does not belong to the application.

I had been asking for the version of VPE, because your coordinates are in 1/10th millimeters, but starting with v4.0 they must be in centimeters - or you must call a special function to turn the coordinates transformation back to 1/10 mm (or even to inch coordinates).

Most importantly ALL coordinates are passed now as double types and not as integers. This is the reason why your app crashes.

Everything I have explained in this post here, is in detail explained in the "Release Notes" installed with VPE v4.0. Please read this file carefully, as advised in our e-mails, which had been sent to all customers when VPE v4.0 had been released.
IDEAL Software Support
 
Posts: 1633
Joined: Thu Nov 18, 2004 4:03 pm

still not working!!!!!!!

Postby BartG » Wed Oct 08, 2008 8:21 pm

Ok, I read the install notes and implemented everything the way it is suggested. i.e. I did everything you suggested I do in your last reply.

After I do the VpeOpenDocFile(), I do a VpeSetUnitTransformation() and set the unit to inches.

So far, so good. I changed the coordinates to DOUBLES in my code:

PROCEDURE VpeWrite EXTERNAL "c:\windows\system32\vpep3240.dll":
DEFINE INPUT PARAMETER hReport AS HANDLE TO LONG NO-UNDO.
DEFINE INPUT PARAMETER dblPOSX AS DOUBLE NO-UNDO. /*dec*/
DEFINE INPUT PARAMETER dblPOSY AS DOUBLE NO-UNDO. /*dec*/
DEFINE INPUT PARAMETER dblPOSX2 AS DOUBLE NO-UNDO. /*dec*/
DEFINE INPUT PARAMETER dblPOSY2 AS DOUBLE NO-UNDO. /*dec*/
DEFINE INPUT PARAMETER chrTEXT AS CHARACTER NO-UNDO.
DEFINE RETURN PARAMETER dblLastPOS AS DOUBLE NO-UNDO. /*dec*/
END PROCEDURE.


I initialize the variables I am going to use for the coordinates. They must be defined as DECIMAL, because that is the corresponding data-type in PROGRESS:

ASSIGN decX = 1
decY = 1
dec2 = 7
decY2 = 5.

Now I call VpeWrite():

RUN vpeWrite (hDocHdl,decX,decY,decX2,decY2,"Hello World", OUTPUT decLastPosXY).

Everything comes to a screeching halt, just as if the program were in a loop, and I still get an access-violation:

Exception code: C0000005 ACCESS_VIOLATION
Fault address: 04E785BB 01:000275BB c:\windows\system32\vpep3240.dll

Registers:
EAX:00000000
EBX:0142F06C
ECX:0012FC14
EDX:0012FC10
ESI:00000000
EDI:0142F04C
CS:EIP:001B:04E785BB
SS:ESP:0023:0012FDB4 EBP:0012FC00
DS:0023 ES:0023 FS:003B GS:0000
Flags:00010246

Call Stack:
Address Frame
04E785BB 0012FC00 VpePurgeFontSubstitution+11FB
04E72C85 0012FDAC VpeWriteDoc+15
1024C375 015ED4E4 pam_get_item+634B5

The same thing happens if I try to set the FONT (I did this just as an experiment to see what would happen):

RUN VpeSetFont (hDocHdl,"Arial",10).

I get the same thing, the program just goes to sleep until I cancel it, and I get the following Access Violation in the dump:

Exception code: C0000005 ACCESS_VIOLATION
Fault address: 04FF17CF 01:000207CF c:\windows\system32\vpep3240.dll

Registers:
EAX:013CF0D0
EBX:01FCC064
ECX:013CF0B0
EDX:017AC358
ESI:013CF0B0
EDI:01848D6C
CS:EIP:001B:04FF17CF
SS:ESP:0023:0012FDB4 EBP:0012FDAC
DS:0023 ES:0023 FS:003B GS:0000
Flags:00010202

Call Stack:
Address Frame
04FF17CF 0012FDAC VpeSetFontName+F
1024C375 0184D8EC pam_get_item+634B5

When you say:
C0000005 ACCESS_VIOLATION means that memory is addressed, which does not belong to the application.

What does that mean to me? Is it not finding the document? How can I find out why this DLL isn't working? Do you have any clients runnning Progress that might be able to help me?

I am trying to write just a simple, from scratch application, and this is becoming very frustrating. There must be a way to get a simple "HELLO WORLD" to print out to a VPE file!
BartG
 
Posts: 17
Joined: Tue Mar 18, 2008 5:06 pm
Location: Scottsdale,AZ

p.s....here's another dump error I get...

Postby BartG » Wed Oct 08, 2008 8:38 pm

Maybe this will tell you something? I get this if I try to do the vpeWriteDoc without doing the vpeSetFont():

Exception code: C0000005 ACCESS_VIOLATION
Fault address: 0537A1C3 01:000191C3 c:\windows\system32\vpep3240.dll

Registers:
EAX:0012FB00
EBX:013FF1B0
ECX:00000000
EDX:013FF1A8
ESI:01E5C290
EDI:013FF1B0
CS:EIP:001B:0537A1C3
SS:ESP:0023:0012FAC8 EBP:0012FB5C
DS:0023 ES:0023 FS:003B GS:0000
Flags:00010206

Call Stack:
Address Frame
0537A1C3 0012FB5C VpeGetReleaseNumber+CF73

Thanks,

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

Postby IDEAL Software Support » Thu Oct 09, 2008 2:07 pm

To clarify things for readers of this forum: Normally one uses the VPE ActiveX component with Progress, so that there are no such problems.

The rest of our answer can be found in the next topic, which has been created by BartG regarding the same issue.
IDEAL Software Support
 
Posts: 1633
Joined: Thu Nov 18, 2004 4:03 pm


Return to VPE Open Forum

Who is online

Users browsing this forum: No registered users and 12 guests