1. removing windows style
------=_NextPart_000_0005_01C04771.43FE7500
charset="iso-8859-2"
Content-Transfer-Encoding: quoted-printable
how do i remove windows style from already created window?
example: status window has border (WS_BORDER). how can i make it so that =
it won't have border?
i know it can be done, just forgot how
------=_NextPart_000_0005_01C04771.43FE7500
charset="iso-8859-2"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content=3D"text/html; charset=3Diso-8859-2" =
http-equiv=3DContent-Type>
<META content=3D"MSHTML 5.00.2614.3401" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>how do i remove windows style from =
already created=20
window?</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2>example: status window has border =
(WS_BORDER). how=20
can i make it so that it won't have border?</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2>i know it can be done, just forgot=20
------=_NextPart_000_0005_01C04771.43FE7500--
2. Re: removing windows style
----- Original Message -----
>From: =A9koda
>how do i remove windows style from already created window?
Hi =A9koda ,
there is a routine in win32lib called "removeStyle" that was meant to do
this. However, it doesn't work for Windows. I've fixed this and the code
below is what you need. You can replace the existing removeStyle with thi=
s
new code. This fix will be posted to the patch area later today.
I've also include a new procedure called "addStyle" which does the
opposite, namely adding styles to the existing ones.
------------------------------------------------------------
--/topic Utilities
--/proc removeStyle( id, style )
--/desc Remove a style from a control.
--If /i style is an atom then only the normal Windows style is modified,
-- but if style is a sequence, it must be a tw-atom sequence. The first i=
s
-- the normal styles, and the second is the extended styles.
--
--Example
--/code
-- removeStyle(w1, {
-- -- normal styles
-- (WS_MINIMIZEBOX+WS_MAXIMIZEBOX+WS_THICKFRAME),
-- -- extended styles
-- (WS_EX_CLIENTEDGE)
-- })
--/endcode
global procedure removeStyle( integer id, object styles )
atom curStyle, styleMask, hWnd, style
hWnd =3D getHandle( id )
if sequence(styles) then
style =3D styles[1]
else
style =3D styles
end if
if style !=3D 0 then
curStyle =3D c_func( xGetWindowLong, { hWnd, GWL_STYLE })
styleMask =3D xor_bits( #FFFFFFFF, style )
style =3D and_bits( styleMask ,curStyle )
VOID =3D c_func( xSetWindowLong,{ hWnd, GWL_STYLE, style })
end if
if sequence(styles)
and styles[2] !=3D 0
then
style =3D styles[2]
curStyle =3D c_func( xGetWindowLong, { hWnd, GWL_EXSTYLE })
styleMask =3D xor_bits( #FFFFFFFF, style )
style =3D and_bits( styleMask ,curStyle )
VOID =3D c_func( xSetWindowLong,{ hWnd, GWL_EXSTYLE, style })
end if
if window_type[id] =3D Window then
VOID =3D c_func(xSetForegroundWindow, {hWnd})
VOID =3D c_func(xSetWindowPos, {hWnd, 0, 0, 0, 0, 0, 39})
end if
end procedure
--/topic Utilities
--/proc addStyle( id, style )
--/desc Add a style to a control.
--If /i style is an atom then only the normal Windows style is modified,
-- but if style is a sequence, it must be a tw-atom sequence. The first i=
s
-- the normal styles, and the second is the extended styles.
--
--Example
--/code
-- addStyle(w1, {
-- -- normal styles
-- (WS_MINIMIZEBOX+WS_MAXIMIZEBOX+WS_THICKFRAME),
-- -- extended styles
-- (WS_EX_CLIENTEDGE)
-- })
--/endcode
global procedure addStyle( integer id, object styles )
atom curStyle, hWnd, style
hWnd =3D getHandle( id )
if sequence(styles) then
style =3D styles[1]
else
style =3D styles
end if
if style !=3D 0 then
curStyle =3D c_func( xGetWindowLong, { hWnd, GWL_STYLE })
style =3D or_bits( style ,curStyle )
VOID =3D c_func( xSetWindowLong,{ hWnd, GWL_STYLE, style })
end if
if sequence(styles)
and styles[2] !=3D 0
then
style =3D styles[2]
curStyle =3D c_func( xGetWindowLong, { hWnd, GWL_EXSTYLE })
style =3D or_bits( style ,curStyle )
VOID =3D c_func( xSetWindowLong,{ hWnd, GWL_EXSTYLE, style })
end if
if window_type[id] =3D Window then
VOID =3D c_func(xSetForegroundWindow, {hWnd})
VOID =3D c_func(xSetWindowPos, {hWnd, 0, 0, 0, 0, 0, 39})
end if
end procedure
----------------------------
cheers,
------
Derek Parnell
Melbourne, Australia
(Vote [1] The Cheshire Cat for Internet Mascot)
3. Re: removing windows style
great stuff !
--
PS. Check out my site at http:/www10.ewebcity.com/tskoda, it's working
again.