I am trying to use DllCall() with the SharedVar application, although I did get some results back, however the results are not accurate, for example:
svRealmCount
Expected Result: 1
Actual Result: -1
svVersion
Expected Result: 1.2.0.310
Actual Result: 491035856
Why is that?
[Background]
The SharedVar is an application used to store real-time data across trading platforms. The trading platform can use DLL to get/store data.
https://fx1.net/sharedvar.php
You see 4 different .dll files:
SharedVar-a32.dll : ANSI 32bit DLL
SharedVar-a64.dll : ANSI 64bit DLL
SharedVar-w32.dll : UNICODE 32bit DLL
SharedVar-w64.dll : UNICODE 64bit DLL
I used the “SharedVar-a64.dll” to test it, however I also tried “SharedVar-w64.dll”. Both return wrong results.
[My Test Script]
Please find below my test script:
Code: Select all
; ------------------------------------------------------------------------------
#SingleInstance, Force ; Force AHK to only run this script once (one at a time)
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory
DetectHiddenWindows, On
; ------------------------------------------------------------------------------
; Main
Get_Data_SV()
Return
; ------------------------------------------------------------------------------
Get_Data_SV(){
; SharedVar-a32.dll : ANSI 32bit DLL
; SharedVar-a64.dll : ANSI 64bit DLL
; SharedVar-w32.dll : UNICODE 32bit DLL
; SharedVar-w64.dll : UNICODE 64bit DLL
; If you have MultiCharts 64bit, you should use ANSI 64bit
; Result := DllCall("C:\Program Files\TS Support\MultiCharts64\SharedVar-a64.dll\svRealmName", "Str" "ea1")
; Result := DllCall("SharedVar-a64.dll\svRealmName", "Str" "ea1")
; Result := DllCall("SharedVar-w64.dll\svRealmName", "Str" "ea1")
; Result := DllCall("SharedVar-w64.dll\svRealmCount")
; Result := DllCall("SharedVar-a64.dll\svRealmCount")
Result := DllCall("C:\Program Files\TS Support\MultiCharts64\SharedVar-a64.dll\svRealmCount")
msgbox, "svRealmCount: " %Result%
; Expected Result: 1
; Actual Result: -1
; Result := DllCall("C:\Program Files\TS Support\MultiCharts64\SharedVar-a64.dll\svVersion", "Cdecl AStr")
; Result := DllCall("C:\Program Files\TS Support\MultiCharts64\SharedVar-a64.dll\svVersion")
Result := DllCall("SharedVar-a32.dll\svVersion")
msgbox, "svVersion-32: " %Result%
Result := DllCall("SharedVar-a64.dll\svVersion")
msgbox, "svVersion-64: " %Result%
; Expected Result: 1.2.0.310
; Actual Result: 491035856
Result := DllCall("C:\Program Files\TS Support\MultiCharts64\SharedVar-a64.dll\svRealmName", "Int64", 2640)
msgbox, "svRealmName: " %Result%
Result := DllCall("C:\Program Files\TS Support\MultiCharts64\SharedVar-a64.dll\svServerRunning")
msgbox, "svServerRunning: " %Result%
}