I'm trying to convert old TASM-code to MASM, but i've run across this very weird bug: I'm trying to create a window whose size, as reported by GetClientRect, is 800 by 600. So the width and height of the window must to be 6 and 25 pixels larger to compensate for the borders and title bar. This works in TASM, but not in MASM: for a reason I cannot understand, the borders in MASM are 2 pixels wider in every direction (so the width and height are 4 pixels off)
I've disassembled both binaries with OlyyDBG, and the parameters are exactly the same. The style is WS_VISIBLE OR WS_POPUP OR WS_CAPTION OR WS_MINIMIZEBOX (90C20000 hex in both cases), and the extended style is WS_EX_OVERLAPPEDWINDOW (300 hex in both cases).
There are differences in the parameters I use for TASM and MASM (debug info, object format etc) but I don't understand that this would make a difference. Anybody knows what could be the cause??
I've disassembled both binaries with OlyyDBG, and the parameters are exactly the same. The style is WS_VISIBLE OR WS_POPUP OR WS_CAPTION OR WS_MINIMIZEBOX (90C20000 hex in both cases), and the extended style is WS_EX_OVERLAPPEDWINDOW (300 hex in both cases).
There are differences in the parameters I use for TASM and MASM (debug info, object format etc) but I don't understand that this would make a difference. Anybody knows what could be the cause??
With WS_THICKFRAME off you get a thinner border (Style).
Giovanni
Giovanni
I?m not sure if this is what you?re doing but here?s my advice?
Use this
; Adjust the x and y coordinates to include the border and title bar
invoke AdjustWindowRectEx, (addr of a rect scruct), (dwStyle flags), FALSE, (dwExStyle flags)
It works great for me when I want the client area to be exactly the dimensions I specify.
Use this
; Adjust the x and y coordinates to include the border and title bar
invoke AdjustWindowRectEx, (addr of a rect scruct), (dwStyle flags), FALSE, (dwExStyle flags)
It works great for me when I want the client area to be exactly the dimensions I specify.
Does your version of TLINK32 have a /V switch for setting the subsystem version? There are subtle differences between 3.x subsystems and 4.x (and 5.x) subsystems.
You can also try setting the subsystem version in MASM with the /SUBSYSTEM switch. For instance, if you want your program to display 3.1 behavior, you use /subsystem:windows,3.10 as part of your linker options.
You can also try setting the subsystem version in MASM with the /SUBSYSTEM switch. For instance, if you want your program to display 3.1 behavior, you use /subsystem:windows,3.10 as part of your linker options.
You shouldn't use "6" and "25" constants directly, as titlebar and
border size may vary (themes, even worse after XP arrived).
AdjustWindowRectEx is nice :)
border size may vary (themes, even worse after XP arrived).
AdjustWindowRectEx is nice :)
Thanks Tenkey, using subsystem:windows,3.10 solved the problem :) Is there some place I can read more about the difference between those subsystems? I guess they can cause some *really* obscure bugs if you don't know this...
To the others: thanks for the suggestions, I was looking for an explanation for the strange behaviour rather than for a workaround, but I suppose using that AdjustWindowRectExt method will be more robust so I'll use it in my new code.
To the others: thanks for the suggestions, I was looking for an explanation for the strange behaviour rather than for a workaround, but I suppose using that AdjustWindowRectExt method will be more robust so I'll use it in my new code.
I went to http://msdn.microsoft.com/library/default.asp and searched for "subsystem".
Here's the page I found:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/win32/verdiff_41o3.asp
Here's the page I found:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/win32/verdiff_41o3.asp