Jump to content

Dll Calling Help


Recommended Posts

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.

Link to comment
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 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
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:

Link to comment
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.

 
Link to comment
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 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...