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:
YaWNS
EDIT:
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
See now, what I mean?
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:
YaWNS
EDIT:
--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?
Do you mean GetModuleHandle or CreateFileMapping or something like that?
You could create an array of handles like this:
Then use a non-volatile register that points to the right handle:
Thomas
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
Thomas
you might go with this...
say you want to destroy the third window...
you can also define arrays...
.DATA?
CW_STRUC STRUCT
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_STRUC ENDS
_CW_SIZE EQU sizeof ( CW_STRUC )
.DATA
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
.CODE
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,
[edi].x,[edi].y,[edi].nWidth,[edi].nHeight,[edi].hWndParent,
[edi].hMenu,[edi].hInstance,[edi].lpParam
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...
.DATA
_Windows CW_STRUC 256 dup (<>)