Sign in to follow this  
Followers 0
devilyn

Help with DLL calls

4 posts in this topic

hello all,

i need help calling a dll using the information bellow

"DLL API Doc:

AEC_PCTC_GET_NUMBER_OF_DEVICES QuickInfo Overview Group

The AEC_PCTC_GET_NUMBER_OF_DEVICES function returns the number of

devices that the DLL detected upon being loaded by the operating

system. This count is based upon the device registry and should

be the same as the number of "WinRTdevX" devices (where X = 0-15)

that the 'DLLMAIN' function automatically detected. In other

words, the number of AEC time code boards installed in the

computer should equal the count that this function returns.

int AEC_PCTC_GET_NUMBER_OF_DEVICES(

VOID

);

PARAMETERS:

(NONE)

RETURN VALUE:

This function returns an int which has a value from 0-16d.

If only one time code board is installed, should be 01h."

this is what i got so far but it doesn't seems to work.

$dll = DllOpen(@ScriptDir&"\AEC_NTTC.dll")
ConsoleWrite("Dll Handle:"&$dll&@CRLF)
$result = DllCall($dll, "int", "AEC_PCTC_GET_NUMBER_OF_DEVICES")
MsgBox(0,"",$result)
DllClose($dll)

thanks in advance

Share this post


Link to post
Share on other sites



DllCall() returns an array.

$hDll = DllOpen(@ScriptDir & '\AEC_NTTC.dll')
$aResult = DllCall($hDll, 'int', 'AEC_PCTC_GET_NUMBER_OF_DEVICES')
If @error Then
    MsgBox(0, '', 'DllCall() error: ' & @error)
Else
    MsgBox(0, '', 'Result: ' & $aResult[0])
EndIf
DllClose($hDll)

Share this post


Link to post
Share on other sites

Hey i wanted to thank you for helping me with the dll call. it was really helpful.

now i have another call i'm struggling with cant figure out how to use lpdword & lpword.

Heres the info:

AEC_PCTC_READ_4BYTES QuickInfo Overview Group

The AEC_PCTC_READ_4BYTES function reads four data bytes at

the offset address specified (for the board whose address is

also passed as a parameter), and places the data into the

double word variable whose address is passed as a parameter.

BOOL AEC_PCTC_READ_4BYTES(

LPDWORD lpReadL,

LPWORD lpAddrOff,

LPWORD lpBrdAddr

);

PARAMETERS:

lpReadL

This parameter points to the double word variable

which will receive the four bytes read from the board.

lpAddrOff

This parameter points to a 16-bit word which contains

an OFFSET address (relative to the base address of the

board) for the byte to be read from the board.

Note that the offset address must be limited to 00h

for IOR & MMR boards, and must be limited to 000h-3FCh

for all other PC-LTC, PC-VITC, and PC-VLTC boards.

lpBrdAddr

Identifies the base address where the board

is installed (or may be installed). For example,

set lpBrdAddr = &Address, where WORD Address = 0xCC00

(memory mapped), or Address = 0x2A0 (I/O mapped).

Set Address to match the board's address jumper.

RETURN VALUE:

The function returns a TRUE (1, OK) or FALSE (0, error).

REMARKS:

Reads the four bytes starting at the desired offset

address (with respect to the board's base address).

For IOR and MMR boards, the only allowable offset value

is 00h (any other value will return an error).

thanks in advance

Share this post


Link to post
Share on other sites

$aResult = DllCall('AEC_NTTC.dll', 'bool', 'AEC_PCTC_READ_4BYTES', 'dword*', $iReadL, 'word*', $iAddrOff, 'word*', $iBrdAddr)
If (@error) Or (Not $aResult[0]) Then
    MsgBox(0, '', 'Error!')
Else
    MsgBox(0, '', 'OK')
EndIf

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