PXC_SetTextLeading replying Bad DLL calling convention - VB6

This Forum is for the use of Software Developers requiring help and assistance for Tracker Software's PDF-Tools SDK of Library DLL functions(only) - Please use the PDF-XChange Drivers API SDK Forum for assistance with all PDF Print Driver related topics or PDF-XChange Viewer SDK if appropriate.

Moderators: TrackerSupp-Daniel, Tracker Support, Vasyl-Tracker Dev Team, Chris - Tracker Supp, Sean - Tracker, Tracker Supp-Stefan

NBachus
User
Posts: 31
Joined: Tue Oct 26, 2010 2:40 pm

PXC_SetTextLeading replying Bad DLL calling convention - VB6

Post by NBachus »

When calling the function PXC_SetTextLeading with the following declaration and call method, VB6 shows the error dialog of "Bad DLL calling convention". Is there something that I am doing wrong?

Code Here:

Public Declare Function PXC_SetTextLeading Lib "pxclib40.dll" (ByVal content As Long, ByVal Leading As Double, ByVal oldLeading As Double) As Long

hr = PXC_SetTextLeading(hDstPage, TextElement.Leading, 0)
User avatar
Lzcat - Tracker Supp
Site Admin
Posts: 677
Joined: Thu Jun 28, 2007 8:42 am

Re: PXC_SetTextLeading replying Bad DLL calling convention - VB6

Post by Lzcat - Tracker Supp »

C++ declaration is

Code: Select all

PDFXCLIB_API	HRESULT PXC_API PXC_SetTextScaling(_PXCContent* content, double scale, double* oldscale);
so yours should be

Code: Select all

Public Declare Function PXC_SetTextLeading Lib "pxclib40.dll" (ByVal content As Long, ByVal Leading As Double, ByRef oldLeading As Double) As Long

Dim OldLeading As Double
hr = PXC_SetTextLeading(hDstPage, TextElement.Leading, OldLeading)
Victor
Tracker Software
Project manager

Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
NBachus
User
Posts: 31
Joined: Tue Oct 26, 2010 2:40 pm

Re: PXC_SetTextLeading replying Bad DLL calling convention - VB6

Post by NBachus »

Thanks! Replacing the third parameter with ByRef instead of ByVal fixed this issue.
User avatar
John - Tracker Supp
Site Admin
Posts: 5219
Joined: Tue Jun 29, 2004 10:34 am
Location: United Kingdom

Re: PXC_SetTextLeading replying Bad DLL calling convention - VB6

Post by John - Tracker Supp »

Excellent news - thanks for coming back :)
If posting files to this forum - you must archive the files to a ZIP, RAR or 7z file or they will not be uploaded - thank you.

Best regards
Tracker Support
http://www.tracker-software.com