Screenshotting DLL Call failing on one computer

Get help with using AutoHotkey and its commands and hotkeys
softwareeater
Posts: 40
Joined: 31 Aug 2015, 11:33

Screenshotting DLL Call failing on one computer

17 Jan 2017, 12:33

So I have a script that takes screenshots and saves them silently, and it's worked on most of my computers. But now I've run into difficulty. A side-by side comparison of it working and not working showed that both computers got to the line "Loop, %encodersSize%" but the failing computer skipped right over it, presumably since the var ended up blank. Any thoughts on this would be super appreciated, I'm a bit in over my head with all this DLL call stuff.

A snippet of my code:

Code: [Select all] [Expand] [Download] (Untitled.ahk)GeSHi © Codebox Plus

kon
Posts: 1760
Joined: 29 Sep 2013, 17:11

Re: Screenshotting DLL Call failing on one computer

17 Jan 2017, 16:12

It looks like your code was originally based on Gdip.ahk. Have a look at the Gdip_All version of the Gdip_SaveBitmapToFile function to see a 64 bit compatible implementation.

32 Bit AHK: Ptr = 4 Bytes
64 Bit AHK: Ptr = 8 Bytes

Gdip_All.ahk goes out of its way to remain AHK v1.0 compatible, but you probably don't want to do that. For example, StrGet_Name := "StrGet" is only included because the built-in StrGet function would throw a "Call to nonexistent function." error in v1.0. Gdip_All.ahk calls StrGet dynamically to avoid the error.
gwarble
Posts: 232
Joined: 30 Sep 2013, 15:01

Re: Screenshotting DLL Call failing on one computer

17 Jan 2017, 23:23

It looks like gdi+ called directly, not with gdip ahk library, but the problem may be the same, check your bit-ness/unicodeness on each machine (or test by dragging directly to the 32bit and 64bit ahk version exes... )

to make the code universal enough to work on each, you probably have to adjust the widechartomultibyte call to be 64bit compatible, using a_ptrsize for the proper bit depth
EitherMouse - Multiple mice, individual settings . . . . www.EitherMouse.com . . . . forum . . . .
kon
Posts: 1760
Joined: 29 Sep 2013, 17:11

Re: Screenshotting DLL Call failing on one computer

17 Jan 2017, 23:45

gwarble wrote:It looks like gdi+ called directly, not with gdip ahk library, but the problem may be the same, check your bit-ness/unicodeness on each machine...
That's what I said. And you missed my main point. Look at Gdip_SaveBitmapToFile. It's almost exactly the same, but Gdip_all already shows a fully compatible version.

Return to “Ask For Help”

Who is online

Users browsing this forum: nonvenomous and 51 guests