Gadget Handles

BlitzPlus Forums/BlitzPlus Programming/Gadget Handles

Mr Brine(Posted 2004) [#1]
Hi!

When ever you create any type of gadget in b+ it returns a value. Im guessing this value points to some kind of structure that holds the various properties of that gadget. So if that is the case, is it possible to peek and poke these properties? If it aint what does this value point to?

Mr Brine


rdodson41(Posted 2004) [#2]
This value points to the bytes in memory that hold the info on the gadget. Unfortunatly its the main computer memory, not a blitz bank. So I doubt you can access the info unless you get into some registry stuff. I saw something in the code archives about registry access.


soja(Posted 2004) [#3]
Registry access?

Here are some Kernel32 functions that I use for memory access:
; Memory
MoveMemory(Dest*, Source%, Length%):"RtlMoveMemory"
CopyMemory(Dest*, Src%, Length%):"RtlMoveMemory"
CopyMemory2(Dest%, Src*, Length%):"RtlMoveMemory"
ZeroMemory(Dest*, Length%):"RtlZeroMemory"
MulDiv%(a*,b%,c%):"MulDiv"


MulDiv is useful if you want to get the true memory address of the contents of a Blitz object (type object or bank). Just call:
mytypeaddr=MulDiv(mytype,1,1)
(Koriolis showed me that one.)

If you want to get the actual Blitz structure, you can use CopyMemory(destTypeObject, sourceTypeObject, length). Be warned that I have no idea what the length is. Probably sizeof(bank or type) + X.


Seldon(Posted 2004) [#4]
The handle you get is an internal Blitz structure, so if you want to change manually the attributes of a gadget (for example) you should look for the real Windows handle (HWND) or most likely you won't have any effect. The Blitz structure surely has inside the real handle (at some offset) , but we have the QueryObject() command to easily retrieve it.