1

I want use a DLL (developed in C++) in WinDev application , my DLL works fine with C# code and i can call any method in there , however with Windev i can successfuly load the DLL using :

hInst = LoadDLL("MyDLL.DLL")

but when i want invoke a method this way :

CallDLL32("MyDLL", "GetCode", data, res1, res2)

i got an error "Attempted to read or write protected memory. This is often an indication that other memory is corrupt."

the method signature that i want call is like this way :

string GetCode([IN] byte[] Data, [OUT] string res1, [OUT] string res2)
Anass Boukalane
  • 539
  • 10
  • 26
  • Problem solved : i used an assembler .net from windev and needs to convert string array to byte array `sMyString is string = "votre chaine de caractère" nDimension is int = Length(sMyString) tabByteArray is array of nDimension 1-byte int K is int FOR K = 1 TO nDimension tabArray[K] = ASC(Middle(sMyString, K, 1)) END` – Anass Boukalane Apr 13 '17 at 12:30

2 Answers2

0

This post in french suggest that you prefix the strings with & because it need to be pass by reference, it should probably looks like :

CallDLL32("MyDLL", "GetCode", &data, &res1, &res2)

Though I don't know how it works with an array of bytes.

Bidjes
  • 166
  • 4
  • 10
-1

You can call Directely: API function

API("USER32", "SendMessageA", hWnd, wMsg, lParam1, lParam2)

documentation: https://doc.windev.com/en-US/?3014005

  • I dont know who gave me -1 and why? If my solution is wrong...he can tell me the mistake. This is a tested solution with documentation link – Mohamed Elleuch Apr 26 '20 at 23:39