Page 2 of 2
Posted: Fri May 26, 2006 10:58 pm
by netmaestro
My macro works as expected, as it's replaced with the CreateWindowEx_ line which returns the hWnd.
Macros don't return anything. You need the window handle of the control. If you stuck the HorizontalbarGadget line as a macro in a #WM_SIZE event it would create a new window every time it resized, resulting in hundreds of new windows in no time and a memory leak you could drive a truck through.
Posted: Fri May 26, 2006 11:13 pm
by netmaestro
ts-soft, very nice piece of work! It's well suited for just this kind of thing as well as having much more potential.
Posted: Sat May 27, 2006 3:47 am
by josku_x
netmaestro wrote:My macro works as expected, as it's replaced with the CreateWindowEx_ line which returns the hWnd.
Macros don't return anything. You need the window handle of the control. If you stuck the HorizontalbarGadget line as a macro in a #WM_SIZE event it would create a new window every time it resized, resulting in hundreds of new windows in no time and a memory leak you could drive a truck through.
Try it!! Use my macro, create a gadget with it, store the 'returned' hWnd and do whatever you want with the hWnd.
Fred said that macros get processed before the line, which means: this line:
Code: Select all
hWnd=HorizontalBarGadget(0, 5, 5, 100)
equals to this:
Code: Select all
hWnd=CreateWindowEx_(0,...........)
and as far I can tell, createWindowEx returns a hWnd. When you store that hWnd, you can use your #wm_size event without problems at all.
EDIT: REad my post carefully!
Here it's again if you didn't see it correctly:
My macro works as expected, as it's replaced with the CreateWindowEx_ line which returns the hWnd.
I said my
MACRO gets automatically
REPLACED with the CreateWindowEx_ one. The
CREATEWINDOWEX_ function
RETURNS the
HWND
I didn't say anything about my macro would return something.
Posted: Sat May 27, 2006 3:50 am
by netmaestro
Yes, I get it - did you read what I said about a memory leak? If you do it that way a new window gets created every time a resize happens - the old one doesn't get freed. If you don't believe me just stick it in your main loop and run with the debugger -> CPU Monitor running. Watch the memory usage for the program rise and rise.
Posted: Sat May 27, 2006 3:52 am
by josku_x
ok I'll check it. but if there's no problems with the memory at all, you shall buy me my coffee
Hey, let's be friends, I hate war.
(although, it would be cool to see you suffer
)
Posted: Sat May 27, 2006 7:14 am
by Dare2
josku_x wrote:Hey, let's be friends, I hate war.
First shoot then say "don't shoot back!"?
josku_x wrote:[ color=white ][ size=7 ](although, it would be cool to see you suffer

)[ /size][ /color]
Ease off a bit, please, josku. You're OTT at times.
Posted: Sat May 27, 2006 8:31 am
by josku_x
OK. I am going to take things more easily. I know I made mess in this forum. And I know I go very easily off-topic. I am really sorry. Just had a few bad days.