Re: Hiding the main MS Window Title Bar

new topic     » goto parent     » topic index » view thread      » older message » newer message

I found the most amazingly simple solution. I wonder if there is something wrong
with it, since it seems to easy.

I am including the code for an entire .exw test file.
include Win32Lib.ew
without warning

constant Window1 = createEx( Window, "Press Escape to toggle", 0, 0, 0, 800,
600, 0, 0 )

constant DRAWIN = createEx( Window, "", Window1, 240, 0, 600, 600,
w32or_all({WS_CHILD, WS_CLIPSIBLINGS, WS_DLGFRAME}), w32or_all({WS_EX_CLIENTEDGE,
WS_EX_STATICEDGE}) )
openWindow(DRAWIN, Normal)
removeStyle(DRAWIN,WS_CAPTION) -- this is not part of original but it is how it
is
moveZOrder( DRAWIN, HWND_TOP)

constant ptx = 1
constant pty = 2
constant DRAWINstart = getPosition(DRAWIN)
integer DRAWINhide -- boolean

setWindowBackColor( DRAWIN, #FFFFFF )
DRAWINhide = w32False
------------------------------------------------------
procedure Window1_onResize (integer self, integer event, sequence
params)--params is ( int style, int cx, int cy )
-- must resize DRAWIN to fit the new size of the main window
-- 800 x 600 for the main window 539 is size and 531 circle

sequence Designer1_xy, DRAWIN_xy
integer cx,cy
Designer1_xy = getClientPoint( Window1, 0, 0 )
DRAWIN_xy = getClientPoint( DRAWIN, 0, 0 )
cx = params[2] - (DRAWIN_xy[ptx] - Designer1_xy[ptx])
cy = params[3] - (DRAWIN_xy[pty] - Designer1_xy[pty])
setCtlSize( DRAWIN, cx, cy )

end procedure
setHandler( Window1, w32HResize, routine_id("Window1_onResize"))
--------------------------------------------------------------------
procedure Screen_keydown(integer Self, integer Event, sequence Params)
-- Application hot key detector

object rv -- for calling handlers
sequence size

if Params[1] = VK_ESCAPE then
	if DRAWINhide then
		addStyle(Window1,WS_CAPTION)
		size = getCtlSize(DRAWIN)
setRect(DRAWIN,DRAWINstart[ptx],0,size[ptx]-DRAWINstart[ptx],size[pty],w32True)
	else
		removeStyle(Window1,WS_CAPTION)
		size = getCtlSize(DRAWIN)
		setRect(DRAWIN,0,0,size[ptx]+DRAWINstart[ptx],size[pty],w32True)
	end if
	DRAWINhide = not DRAWINhide
end if
end procedure
setHandler(Screen, w32HKeyDown, routine_id("Screen_keydown"))
-----------------------------------------------------------------

WinMain( Window1,Normal )


Andy Katz
B.S. Computer Science, 1978
Rensselaer Polytechnic Institute (RPI)

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu