Sign in to follow this  
Followers 0
dmca

Dll Calling Help

5 posts in this topic

Hi, I've been trying to use dllcall on a simple dll that is designed to convert an inputted string into a PDF417 2D barcode.

I have all the info I should be on the dll but I can't seem to get it to work for me.

According to what I've read in the DLL's reference manual, I just have to use a function called PDF417Encode. This function looks like this

void PDF417Encode(

LPCTSTR Message,

WORD Mode,

WORD ErrorCorrectionLevel,

WORD Rows,

WORD Columns,

BOOL TruncateSymbol,

BOOL HandleTilde);

$test=DllCall("PDF417Font.dll", "wstr","test","dword*","2","dword","2","dword","3","dword","3", "int", "0", "int", "0") ;

I know its just something small I must be doing incorrectly with the call. The values I've selected are recommended by the manual as default. I haven't been able to get a returned value at all My end result is to have a script that I pass a string and its simply outputted as the formatted Barcode. Any help would be appreciated, thx.

Share this post


Link to post
Share on other sites



I used h2au3 from the german AutoIt forum to convert the DLL call to AutoIt. Here is the result:

Func PDF417Encode ($Message, $Mode, $ErrorCorrectionLevel, $Rows, $Columns, $TruncateSymbol, $HandleTilde)

    Local $aRes = DllCall ("PDF417Font.dll", "none", "PDF417Encode", _
                                "WSTR", $Message, _
                                "WORD", $Mode, _
                                "WORD", $ErrorCorrectionLevel, _
                                "WORD", $Rows, _
                                "WORD", $Columns, _
                                "BOOL", $TruncateSymbol, _
                                "BOOL", $HandleTilde)
    Return $aRes[0]

EndFunc

As I'm not very firm with DLL calls I can't guarantee that this will work :huh2:


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Thanks for the reply. That's great. That seems to be the format I was using anyway. All It seems to return is '0'. It seems to be processing correctly but there must be something wrong in the way I am returning the value.

I used h2au3 from the german AutoIt forum to convert the DLL call to AutoIt. Here is the result:

Func PDF417Encode ($Message, $Mode, $ErrorCorrectionLevel, $Rows, $Columns, $TruncateSymbol, $HandleTilde)

    Local $aRes = DllCall ("PDF417Font.dll", "none", "PDF417Encode", _
                                "WSTR", $Message, _
                                "WORD", $Mode, _
                                "WORD", $ErrorCorrectionLevel, _
                                "WORD", $Rows, _
                                "WORD", $Columns, _
                                "BOOL", $TruncateSymbol, _
                                "BOOL", $HandleTilde)
    Return $aRes[0]

EndFunc

As I'm not very firm with DLL calls I can't guarantee that this will work :huh2:

Share this post


Link to post
Share on other sites

well you have "none" return tupe, change it according to documantation for that dll

if needed add :cdecl next to return valye

eg.

DllCall("SQLite.dll", "int:cdecl"


TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

 

Share this post


Link to post
Share on other sites

According to the manual "0" means: Everything worked fine. As BogQ noted you have to define the return value which seems to be a pointer to a pointer.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0