I'm glad to help.
Basically, when you pass a struct (C terminology for a custom type) to a DLL, it's just a particular chunk of memory with a certain size. When you create an instance of the PROCESSENTRY32 type, you are creating the chuck of memory. But instead of thinking of it as having a bunch of fields with values, just think of all the values crammed together into one memory chunk.
So, the first 9 parameters are all expected to be DWORDS or LONGS (32 bits each which is the same as a Blitz Int, so that works out just fine). The last parameter is expected to be an array of MAX_PATH (264) TCHARs. A TCHAR is the same as a CHAR which is just 1 byte. So if you add up the number of bytes needed by each parameter, here's what you get:
4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 264 = 300 bytes
(See the MSDN documentation for the PROCCESSENTRY32 structure. I guess you forgot one byte becuase your SizeOf_PE32 = 296...? Or maybe I added one too many.)
Anyway, this means that you can now create your memory chunk to store this in and get it ready to pass to the Windows API:
And then you procede to fill it up with the "in" parts of it (which I think is just the first parameter, right?):
PokeInt(Proc32, 0, BankSize(Proc32)) ; dwSize
Then make the call to Process32First/Next.
Then you can read what it gets back. Something like:
...and then when you get to the last bit, everything from byte 36 to the end of the bank will correspond to szExeFile. You'll have to do something like this:
Does this help you a bit? Is anything unclear?
(Warning -- the code I typed from memory and didn't test it.)
Basically, when you pass a struct (C terminology for a custom type) to a DLL, it's just a particular chunk of memory with a certain size. When you create an instance of the PROCESSENTRY32 type, you are creating the chuck of memory. But instead of thinking of it as having a bunch of fields with values, just think of all the values crammed together into one memory chunk.
So, the first 9 parameters are all expected to be DWORDS or LONGS (32 bits each which is the same as a Blitz Int, so that works out just fine). The last parameter is expected to be an array of MAX_PATH (264) TCHARs. A TCHAR is the same as a CHAR which is just 1 byte. So if you add up the number of bytes needed by each parameter, here's what you get:
4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 264 = 300 bytes
(See the MSDN documentation for the PROCCESSENTRY32 structure. I guess you forgot one byte becuase your SizeOf_PE32 = 296...? Or maybe I added one too many.)
Anyway, this means that you can now create your memory chunk to store this in and get it ready to pass to the Windows API:
Proc32 = CreateBuffer(300)
And then you procede to fill it up with the "in" parts of it (which I think is just the first parameter, right?):
PokeInt(Proc32, 0, BankSize(Proc32)) ; dwSize
Then make the call to Process32First/Next.
Then you can read what it gets back. Something like:
cntUsage = PeekInt(Proc32, 4) ; Offset at 4th byte -- read 4 bytes (sizeof Int) th32ProcessID = PeekInt(Proc32, 8) th32DefaultHeapID = PeekInt(Proc32, 12) ;...etc...
...and then when you get to the last bit, everything from byte 36 to the end of the bank will correspond to szExeFile. You'll have to do something like this:
offset = 36 Repeat char = Peekbyte(Proc32, offset) offset = offset + 1 s$ = s$ + Chr$(char) Until char = 0
Does this help you a bit? Is anything unclear?
(Warning -- the code I typed from memory and didn't test it.)