![Wink ;)](./images/smilies/icon_e_wink.gif)
I started to work with Buffer objects. Once I did it, I'm missing a built-in method to reinitialize an object, e.g. Buffer.Init(0). Any chance to get it?
Code: Select all
#Requires AutoHotkey v2.0-beta.1
Buffer.Prototype.DefineProp('Init', {Call: (this, FillByte := 0) => DllCall('ntdll\RtlFillMemory', 'Ptr', this, 'Ptr', this.Size, 'Int', FillByte)})
Code: Select all
Class ReusableBuffer Extends Buffer {
Clear(FillByte := 0) => DllCall('Ntdll.dll\RtlFillMemory', 'Ptr', This, 'Ptr', This.Size, 'Int', FillByte)
}
This method exists to support Call, and is not intended to be called directly.
ah, nifty. but that ought to be documented then. otherwise its unexpected that specifying a bytecount the same as the old one would result in a realloc, whereas not specifying it wouldnt
Return to “AutoHotkey Development”
Users browsing this forum: No registered users and 33 guests