Converting a file to a byte array means reading the file into memory, then assigning the first byte in memory to the first element of the array, and so on?
If so, I want to pass it to a ocr.dll. I don't know much about this dll file, and the documentation is very bad.
This is an example of calling this dll with C#. But there is an error in line 3, that string cannot be used here. The final result should be obtained from memory. But I don't quite understand what it means.
Code: Select all
[DllImport("ocr.dll")]
public static extern int init();
[DllImport("ocr.dll")]
public static extern int ocr(byte[] bin,int binlength);
Re-edit
Code: Select all
r := ocr("TEST.jpg")
msgbox % r
return
ocr(FilePath)
{
File := FileOpen(FilePath, "r")
size := File.Length
File.RawRead(bin, size)
File.Close()
hModule := DllCall("LoadLibrary", "Str", "ocr.dll", "Ptr")
DllCall("ocr\init")
t := DllCall("ocr.dll\ocr", "ptr", &bin, "int", size)
DllCall("FreeLibrary", "Ptr", hModule)
r := StrGet(&t)
return, r
}
dll Description
.DLL command init, integer, "ocr.dll", "init", , 'Initialize once in the subroutine startup
.DLL command ocr, text type, "ocr.dll", "ocr", , ‘recognition submission
.parameter z_bin, byte set, , submit picture byte set
. parameter ok, integer type, ,
dll file
http://s000.tinyupload.com/?file_id=11129310907512837481