Hi there,

it's me again :eek:

Currently I am playing around with arrays and in the array read loop I inserter some window creation. Now I want to know if there exists any macro or smth which I call in order to have it create my handles on the fly. This would add much more flixibility to my proggy as I would not have to work with constants and not to change a lot of things in the source.

Hope you know what I mean :grin:



--inside code---
|--my array loop--
| after getting array entries for one array
| invoke CreateWindow,......,value1_of_array,value2_of_array,...
| mov hWindowhWnd,eax <- this is my problem!!!!!
| ...
|--array loop end--
--inside code

So, here using it this way I would have to use a counter which increases by one every loopcycle and then check, which number the counter is, and use the handle which is for this.
e.g. it is the forth time I run through the loop so I have to do
mov hWindowhWnd4,eax

See now, what I mean?
Posted on 2001-12-27 09:00:46 by YaWNS
Do you mean GetModuleHandle or CreateFileMapping or something like that?
Posted on 2001-12-27 09:30:29 by CodeLover
You could create an array of handles like this:

hWinArray dd MAX_WINDOWS dup (?)

Then use a non-volatile register that points to the right handle:

; before loop:

mov ebx, offset hWinArray

;in loop:

mov [ebx], eax ;save handle
add ebx, 4 ;move to next handle

Posted on 2001-12-27 11:18:49 by Thomas
you might go with this...


dwExStyle DD ?
lpClassName DD ?
lpWindowName DD ?
dwStyle DD ?
x DD ?
y DD ?
nWidth DD ?
nHeight DD ?
hWndParent DD ?
hMenu DD ?
hInstance DD ?
lpParam DD ?
WndHandle DD ?

_CW_SIZE EQU sizeof ( CW_STRUC )


ClassName db "SOME-CLASS",0
CaptionName db "BBLABLABLA",0

_Windows CW_STRUC < 0,0,offset ClassName,offset CaptionName,0,100,100,100,500,0,0,0,0 >
CW_STRUC < 0,0,offset ClassName,offset CaptionName,0,200,200,200,500,0,0,0,0 >
CW_STRUC < 0,0,offset ClassName,offset CaptionName,0,300,300,300,500,0,0,0,0 >
CW_STRUC < 0,0,offset ClassName,offset CaptionName,0,400,400,400,500,0,0,0,0 >
CW_STRUC < 0,0,offset ClassName,offset CaptionName,0,500,500,500,500,0,0,0,0 >
_Windows_Nbr EQU ( $ - Offset _Windows ) / _CW_SIZE


start: ;...

assume edi: PTR CW_STRUC

mov ebx, _Windows_Nbr
mov edi, offset _Windows

_CW_L: invoke CreateWindowEx,[edi].dwExStyle,[edi].lpClassName,[edi].lpWindowName,[edi].dwStyle,

mov [edi].WndHandle, eax

add edi, _CW_SIZE
dec ebx
jnz _CW_L


say you want to destroy the third window...

mov edi, offset _Windows + ( 3 * _CW_SIZE )
invoke DestroyWindow,[edi].WndHandle

you can also define arrays...

_Windows CW_STRUC 256 dup (<>)
Posted on 2002-01-02 07:34:59 by mob