开发者

How to read memory values using VBScript?

开发者 https://www.devze.com 2023-01-31 18:45 出处:网络
I want to use VBScript to read values directly out of memory of another running application. I can\'t seem to find information on using ReadProcessMemory() in VBScript.

I want to use VBScript to read values directly out of memory of another running application.

I can't seem to find information on using ReadProcessMemory() in VBScript.

I intend to use this in Quick Test Pro to do screen scraping of an application that needs testing. This application does not use any standard controls and using QTP's OCR abilities does not provide us with reliable results.

We currently have code written in AutoIT that reads values of this application directly from memory and converts it to ASCII. But we wa开发者_开发问答nt to remove the reliance on that and using VBScript from within QTP would be ideal.

So can anyone tell me how I can read values from an executable in memory using VBScript?


You can't do this in VBScript directly. As Josh Einstein's comment above mentions, it's impossible to call native Windows API functions directly from VBScript. There are two major reasons why this is the case. First, it would pose obvious security risks for code written in such a scripting language to be able to call native code directly. And second, VBScript only has one data type (Variant), which is not going to work properly with the return values of most of the Windows API functions.

Instead, you'll have to wrap the native API functions that you need in an ActiveX DLL (COM automation object), and then call functions from that library from your VBScript. The wrapper DLL would be designed specifically for VBScript-interoperability and would take care of any necessary data-type conversions, exposing only Variant types and containing all of the necessary (or potentially necessary!) error handling routines. Using VB 6 is the quickest and easiest way to do this and doesn't even require you to learn a new language, but you can also do this from C++, if you're comfortable there.

0

精彩评论

暂无评论...
验证码 换一张
取 消