Declare Problem

Hey. Yeah I tried it last night and it returns “h” for everything. I heard it could be something related to not having the proper C++ redistributable? The good thing is that it does not crash any longer at least. Its always something right?

I tried on both 2017r3 and 2018r1 and have same problem

I’ve just got it running using the dll you provided but again, it only works with 2017r3 and under for me, not 2018r1 or above. The fact that its working in 2017r3 says to me that its got the right redistributable but it doesn’t explain why its not running in the latest version. As for it returning “h”, I’m not sure about that either. If you lacked the redistributable it just wouldn’t work but If you want to try and download the latest redist and try it, you can get the x64 version here.

Other than that, I’m not really sure where to progress with this, part of me wants to zip the whole lot up and put a feedback ticket in about it saying that it runs on 2017r3 but not 2018r1 please help, but another part of me says that I’ve probably done something wrong and as I’ve not built many C++ windows projects I’m not sure.

Sorry, but I don’t think I can shed any more light on this.

Shot in the dark, but what happens if you get rid of the p variable and pass Result2 directly to ReadRegion? The parameter is already a Ptr and is already declared as byref, i.e. a pointer to a pointer which is what I think you need:

Declare Function ReadRegion Lib "OpenScrape.dll" (hWND As Integer, Region As CString, ByRef Results As Ptr, offset As Int32) As Int32 Dim Result2 As New MemoryBlock(256) value = ReadRegion(window1.Handle, name, Result2, 0)

[quote=386087:@Andrew Lambert]Shot in the dark, but what happens if you get rid of the p variable and pass Result2 directly to ReadRegion? The parameter is already a Ptr and is already declared as byref, i.e. a pointer to a pointer which is what I think you need:

Declare Function ReadRegion Lib "OpenScrape.dll" (hWND As Integer, Region As CString, ByRef Results As Ptr, offset As Int32) As Int32 Dim Result2 As New MemoryBlock(256) value = ReadRegion(window1.Handle, name, Result2, 0)[/quote]

Parameter "Results" expects type Ptr, but this is class MemoryBlock. value = ReadRegion(window1.Handle, "p0cardface0rank", Result2, 0)

oops… I’m not sure why I thought that would work.

Could it be the other way around?

Declare Function ReadRegion Lib "OpenScrape.dll" (hWND As Integer, Region As CString, ByRef Results As Ptr, offset As Int32) As Int32 Dim p As Ptr value = ReadRegion(window1.Handle, name, p, 0) Dim Result2 As MemoryBlock = p

Unfortunately not, the routine doesn’t malloc the space and return a pointer to the newly allocated space so you have to allocate some space before the call.