DllCall 32vs64 bit Topic is solved

Get help with using AutoHotkey and its commands and hotkeys
ahklearner
Posts: 279
Joined: 23 Jan 2015, 01:49

DllCall 32vs64 bit

20 Feb 2018, 07:36

Hi Community :wave:

This dll helps convert doc and docx to plain text.

Recently 64bit version released, but it is not working the same way the 32 is working.

Please help me understand and use it.

Any help highly appreciated, thanks in advance :clap:

xd2tx2161_x64.zip = https://drive.google.com/open?id=1BkioNrB6qSCE8-3Pm0vScm978U2nIbMb

32bit Version PERFECT

Code: [Select all] [Download] GeSHi © Codebox Plus

MsgBox, 262144,%AppName% %A_LineNumber%, % ExtractText(Content, FilePath)

ExtractText(ByRef OutputVar, Search)
{
static hModule := DllCall("LoadLibrary", "Str", "xd2txlib.dll", "Ptr")
fileLength := DllCall("xd2txlib\ExtractText", "Str", Search, "Int", False, "Int*", fileText)
OutputVar := StrGet( fileText, fileLength / 2 )
}
Return


Something I think might benefit in understand

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus





64bit Version Help File

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus

just me
Posts: 5459
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: DllCall 32vs64 bit

20 Feb 2018, 09:59

If this is 'working perfectly' on 32-bit

Code: [Select all] [Download] GeSHi © Codebox Plus

ExtractText(ByRef OutputVar, Search)
{
static hModule := DllCall("LoadLibrary", "Str", "xd2txlib.dll", "Ptr")
fileLength := DllCall("xd2txlib\ExtractText", "Str", Search, "Int", False, "Int*", fileText)
OutputVar := StrGet( fileText, fileLength / 2 )
}
this might work on 32-bit and 64-bit

Code: [Select all] [Download] GeSHi © Codebox Plus

ExtractText(ByRef OutputVar, Search)
{
static hModule := DllCall("LoadLibrary", "Str", "xd2txlib.dll", "Ptr")
fileLength := DllCall("xd2txlib\ExtractText", "Str", Search, "Int", False, "Ptr*", fileText)
OutputVar := StrGet( fileText, fileLength / 2 )
}

The last parameter of ExtractText() is a pointer (Ptr). The size of a pointer is 4 bytes on 32-bit (which is equal to the size of an Integer) but 8 bytes on 64-bit.
ahklearner
Posts: 279
Joined: 23 Jan 2015, 01:49

Re: DllCall 32vs64 bit

21 Feb 2018, 02:27

sorry its not

just me wrote:If this is 'working perfectly' on 32-bit

Code: [Select all] [Download] GeSHi © Codebox Plus

ExtractText(ByRef OutputVar, Search)
{
static hModule := DllCall("LoadLibrary", "Str", "xd2txlib.dll", "Ptr")
fileLength := DllCall("xd2txlib\ExtractText", "Str", Search, "Int", False, "Int*", fileText)
OutputVar := StrGet( fileText, fileLength / 2 )
}
this might work on 32-bit and 64-bit

Code: [Select all] [Download] GeSHi © Codebox Plus

ExtractText(ByRef OutputVar, Search)
{
static hModule := DllCall("LoadLibrary", "Str", "xd2txlib.dll", "Ptr")
fileLength := DllCall("xd2txlib\ExtractText", "Str", Search, "Int", False, "Ptr*", fileText)
OutputVar := StrGet( fileText, fileLength / 2 )
}

The last parameter of ExtractText() is a pointer (Ptr). The size of a pointer is 4 bytes on 32-bit (which is equal to the size of an Integer) but 8 bytes on 64-bit.
User avatar
jeeswg
Posts: 4981
Joined: 19 Dec 2016, 01:58
Location: UK

Re: DllCall 32vs64 bit

21 Feb 2018, 03:09

- Perhaps try adding Ptr at the end:
fileLength := DllCall("xd2txlib\ExtractText", "Str", Search, "Int", False, "Ptr*", fileText, "Ptr")
- Perhaps try specifying fileLength as an arbitrary number like 10, to see if fileText is valid.
- What does fileLength return? What about A_LastError?
- Is the 32-bit dll being called both times?
- (I noticed that Cdecl was mentioned, although that would only be a problem for the 32-bit dll, and not the 64-bit dll AFAIK.)
User avatar
nnnik
Posts: 3218
Joined: 30 Sep 2013, 01:01
Location: Germany

Re: DllCall 32vs64 bit

21 Feb 2018, 03:39

Nah the return type is an integer.
But this is using the CDECL calling convention:
Though as you mentioned it's only going to cause issues for the 32 bit version.

Code: [Select all] [Download] GeSHi © Codebox Plus

DllCall("xd2txlib\ExtractText", "WStr", Search, "Int", False, "Ptr*", fileText, "Cdecl int") ;this is the most i could extract from that gibberish that you call help file ( honestly most of the text can't be read on my PC )
;It looks like: Š Ö " ‚ ð d e l e g a t e ‚ Å é Œ ¾ ‚ · ‚ é


OK seems I was incorrect. It's not expecting a AutoHotkey Str type but rather something else.
https://docs.microsoft.com/en-us/dotnet ... or-strings
Recommends AHK Studio
User avatar
jeeswg
Posts: 4981
Joined: 19 Dec 2016, 01:58
Location: UK

Re: DllCall 32vs64 bit

21 Feb 2018, 03:50

@nnnik: Ah yes thanks, it says 'int ExtractText', so Int, I'd read some other part that made me think it might be a Ptr.
tmplinshi
Posts: 1242
Joined: 01 Oct 2013, 14:57

Re: DllCall 32vs64 bit

21 Feb 2018, 06:13

The code works fine here without modification. So I guess you are using 32-bit AHK to call 64-bit dll?
ahklearner
Posts: 279
Joined: 23 Jan 2015, 01:49

Re: DllCall 32vs64 bit

21 Feb 2018, 07:15

Hi,

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus



I am testing with
64bit Win10
AutoHotkeyU64.exe
xd2txlib.dll (64 bit)

I have attached zip containing word doc, script, dll, and AutoHotkeyU64.exe
https://drive.google.com/open?id=1EuewlujqdDTP9qFRd9FH-ouMzFTVB30a

I checked twice the OS, Ahk Version, and Dll but in vain

Please guide me :headwall:
Guest

Re: DllCall 32vs64 bit

21 Feb 2018, 07:24

Code: [Select all] [Download] GeSHi © Codebox Plus

ExtractText(Content, "Document.doc")
MsgBox, 262144,%AppName% %A_LineNumber%, % Content


:roll:
tmplinshi
Posts: 1242
Joined: 01 Oct 2013, 14:57

Re: DllCall 32vs64 bit

21 Feb 2018, 09:42

As Guest wrote, the result is stored in the first parameter.
ahklearner
Posts: 279
Joined: 23 Jan 2015, 01:49

Re: DllCall 32vs64 bit

21 Feb 2018, 13:05

Tried the same from the guest, but again blank :roll:
ahklearner
Posts: 279
Joined: 23 Jan 2015, 01:49

Re: DllCall 32vs64 bit

22 Feb 2018, 07:49

Thanks a lot everyone :dance: , especially "tmplinshi & Guest". :bravo:

I can't express my happiness, may our creator bless you guys with best of both worlds :salute:

Guest wrote:Then install https://www.microsoft.com/en-us/downloa ... x?id=13523 ... and make the changes I posted previously.

Return to “Ask For Help”

Who is online

Users browsing this forum: Carl, FidoGooL and 79 guests