Jump to content

Unable to use the DLL file error when executing a DLLCALL


Recommended Posts

6 hours ago, TheXman said:

Since I have no intention of guessing, I would suggest that you show the code that you attempted to execute and also say which Voicemeeter product was running at the time

That is a fair statement 😄. I took what you provided and came up with the code below to return the current version.

Func VBVMR_GetVoicemeeterVersion($apiDLL)
    Local $aResult, $dBinary
    Local $sVMVer=""
    $aResult = DllCall($apiDLL,"long","VBVMR_GetVoicemeeterVersion","long*",0)
        If @error Then
        ConsoleWriteError('Error VBVMR_GetVoicemeeterVersion: ' & ' Error: ' & @error & ' Extended: ' & @extended & @CR)
    EndIf
    ConsoleWrite("$aResult[1]: "& $aResult[1] &@CRLF)
    ConsoleWrite("Binary: "&Binary($aResult[1]) &@CRLF)
    ConsoleWrite("BinaryMid: " & String(Dec(Int(BinaryMid($aResult[1],4,1)))) &@CRLF)
    For $i = 4 To 1 Step -1
        If $i > 1 Then
            $sVMVer &= String(Dec(Int(BinaryMid($aResult[1],$i,1)))) & "."
        Else
            $sVMVer &= String(Dec(Int(BinaryMid($aResult[1],$i,1))))
        EndIf
    Next
    ConsoleWrite("Derived version: " & $sVMVer & @CRLF)
EndFunc

It's a little busy but I left my learning / testing there... The console writes return this:

$aResult[1]: 50332162
Binary: 0x02020003
BinaryMid: 3
Derived version: 3.0.2.2

The reason I went with reversing the resulting binary numbers is the version of Potato I have, reports as 3.0.2.2

I can see a use for this function elsewhere in one form or another.

This has given me quite a bit to build on. I appreciate the help! I will go and clean up the spaghetti code and make it more presentable.

VM_Version.jpg

Link to post
Share on other sites
2 hours ago, gritts said:

The reason I went with reversing the resulting binary numbers is the version of Potato I have, reports as 3.0.2.2

That's because Windows PCs are little-endian machines. The value 50332162 converts to hex 0x3000202 and is stored in a little-endian long.

Here's how this value is stored in memory [the function vd() is a variable dump and cw() is a kind of ConsoleWrite]:

$tLong = DllStructCreate("ulong value")
$tBytes = DllStructCreate("byte b3; byte b2; byte b1; byte b0", DllStructGetPtr($tLong))
$tLong.value = 50332162

vd($tlong)
vd($tBytes)

cw('Version is: ' & $tBytes.b0 & '.' & $tBytes.b1 & '.' & $tBytes.b2 & '.' & $tBytes.b3)

Outputs:

Struct             (4) @:000001382BD8A680 (structure alignment is unknown)
      uint       50332162

Struct             (4) @:000001382BD8A680 (structure alignment is unknown)
      byte       2
      byte       2
      byte       0
      byte       3

Version is: 3.0.2.2

 

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Link to post
Share on other sites
9 hours ago, gritts said:

This has given me quite a bit to build on. I appreciate the help!

You're welcome! 

You did a great job of translating what I said into code.  The fact that you were able to come up with a workable solution is what's most important when learning, not necessarily how pretty the code is.  As you continue learning new things and techniques, you can always go back to sharpen & optimize your code.   Things that you figure out on your own are usually retained longer, recalled quicker, and give you a better understanding of how things work.  That's why I didn't just give you the code that I used. 

:thumbsup:

Link to post
Share on other sites

Appreciate all the help... I'm posting my messy learning script here for others that might need an assist. I have a number of other ideas for improvement I want to put in place. Now I just need to time fairy to come by. 😁 I'm using .INI to save the settings currently. Might change that as I go...

 

voicemeeter_test_4.au3

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
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...