Tratando de llamar a una C DLL desde VB. No se puede hacer funcionar uno de los parámetros.
Tratando de configurar una regleta de alimentación USB.
Aquí está la documentación:
Initializes the Power USB API.
Name: InitPowerUSB
Parameters: model:returns the model number(1:basic, 2:digIO, 3:watchdog, 4:Smart), firmware: returns firmware version in ?.? format in a character string (major revision and minor revision)
Return: >0 if successful. Returns number of PowerUSB devices connected
C++ Example:
if (!m_pwrUSBInit)
{
int model; char firmware[8];
if ((ret=InitPowerUSB(&model, firmware)) > 0)
{
m_pwrUSBInit = 1;
m_numDevices = ret;
}
}
He estado tratando de hacer que esto funcione con mi código VB6 por alrededor de una hora sin suerte. El programa o se bloquea, muestra un error comoBad Calling Dll Convention
, type mismatch
, etcétera.
Esto es lo que tengo:
Public Declare Function InitPowerUSB Lib "PwrUSBDll.dll" (ByRef model As Integer, ByVal firmware As String) As Integer
Dim model As Integer
model = 0
Dim firmware As String
firmware = ""
If (InitPowerUSB(model, firmware)) > 0) Then
EndIf
He intentado cambiar el firmware a arrays de bytes, byref, cadena, entero, largo, etc. Simplemente no parece querer ejecutarse.
¿Alguien sabe de una solución a este problema? Gracias