1. Hiding the main MS Window Title Bar

I am interested to see if I can programmatically toggle the Title bar of a MS
Windows application in order to maximize the space for my application.

How is this done, if anyone here knows?

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

new topic     » topic index » view message » categorize

2. Re: Hiding the main MS Window Title Bar

Andrew Katz wrote:
> 
> I am interested to see if I can programmatically toggle the Title bar of a MS
> Windows application in order to maximize the space for my application.
> 
> How is this done, if anyone here knows?
> 
> Andy Katz
> B.S. Computer Science, 1978
> Rensselaer Polytechnic Institute (RPI)

You might be able to use Win32lib's removeStyle and addStyle. You could addStyle
WS_POPUP, WS_THICKFRAME after removeStyle WS_MAXIMIZEBOX, WS_MINIMIZEBOX and
whatever else you need to remove. Then reverse to show the window normally again.

new topic     » goto parent     » topic index » view message » categorize

3. Re: Hiding the main MS Window Title Bar

Judith Evans wrote:
> 
> Andrew Katz wrote:
> > 
> > I am interested to see if I can programmatically toggle the Title bar of a
> > MS
> > Windows application in order to maximize the space for my application.
> > 
> > How is this done, if anyone here knows?
> > 
> > Andy Katz
> > B.S. Computer Science, 1978
> > Rensselaer Polytechnic Institute (RPI)
> 
> You might be able to use Win32lib's removeStyle and addStyle. You could
> addStyle
> WS_POPUP, WS_THICKFRAME after removeStyle WS_MAXIMIZEBOX, WS_MINIMIZEBOX and
> whatever else you need to remove. Then reverse to show the window normally
> again.

Why not just reposition the window so that the top left corner is just above
 & outside the screen corner?

Mike

new topic     » goto parent     » topic index » view message » categorize

4. Re: Hiding the main MS Window Title Bar

Mike wrote:
> 
> Judith Evans wrote:
> > 
> > Andrew Katz wrote:
> > > 
> > > I am interested to see if I can programmatically toggle the Title bar of a
> > > MS
> > > Windows application in order to maximize the space for my application.
> > > 
> > > How is this done, if anyone here knows?
> > > 
> > > Andy Katz
> > > B.S. Computer Science, 1978
> > > Rensselaer Polytechnic Institute (RPI)
> > 
> > You might be able to use Win32lib's removeStyle and addStyle. You could
> > addStyle
> > WS_POPUP, WS_THICKFRAME after removeStyle WS_MAXIMIZEBOX, WS_MINIMIZEBOX and
> > whatever else you need to remove. Then reverse to show the window normally
> > again.
> 
> Why not just reposition the window so that the top left corner is just above
>  & outside the screen corner?
> 
> Mike

How do I position there? Do I calculate negative numbers?

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

new topic     » goto parent     » topic index » view message » categorize

5. Re: Hiding the main MS Window Title Bar

Judith Evans wrote:
> 
> Andrew Katz wrote:
> > 
> > I am interested to see if I can programmatically toggle the Title bar of a
> > MS
> > Windows application in order to maximize the space for my application.
> > 
> > How is this done, if anyone here knows?
> > 
> > Andy Katz
> > B.S. Computer Science, 1978
> > Rensselaer Polytechnic Institute (RPI)
> 
> You might be able to use Win32lib's removeStyle and addStyle. You could
> addStyle
> WS_POPUP, WS_THICKFRAME after removeStyle WS_MAXIMIZEBOX, WS_MINIMIZEBOX and
> whatever else you need to remove. Then reverse to show the window normally
> again.

While I use Arwen instead of win32lib, you might be interested in routine F11()
in edita.exw. Your job will be simplified if not getting rid of menus, toobar,
tab bar, file panel, message area, and status bar, like I am. If it is full
screen you want, rather than just reducing frills on a non-maximised window, it
should at least prove that what you want is possible.

Regards,
Pete

new topic     » goto parent     » topic index » view message » categorize

6. Re: Hiding the main MS Window Title Bar

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 message » categorize

7. Re: Hiding the main MS Window Title Bar

Pete Lomax wrote:
> 
..... 
> While I use Arwen instead of win32lib, you might be interested in routine
> F11()
> in edita.exw. Your job will be simplified if not getting rid of menus, toobar,
> tab bar, file panel, message area, and status bar, like I am. If it is full
> screen you want, rather than just reducing frills on a non-maximised window,
> it should at least prove that what you want is possible.
> 
> Regards,
> Pete

I did not know about Edita until today. I knew about the Ed for Euphoria, but I
have been using Crimson editor, and the editor inside of the win32lib IDE. This
editor of yours seems to be suited for Euphoria! I still am not sure what Arwin
is. I have been reading on the forum a sort of competition between win32lib and
wxEuphoria. Where does Arwin fit into that?

And I saw what you do in F11() and it looks similar to what I found in my
research online. That is why I would like you to look at what I did and how
simple it is. And I think maybe I over stated what I wanted to do, or I am
missing something. The key line in my code is:
removeStyle(Window1,WS_CAPTION)

of course this is for win32lib.

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

new topic     » goto parent     » topic index » view message » categorize

8. Re: Hiding the main MS Window Title Bar

Andrew Katz wrote:
> I would like you to look at what I did and how simple it is.
> of course this is for win32lib.
Try this:
include Win32Lib.ew
without warning

constant Window1 = createEx( Window, "Press Escape to toggle", 0, 0, 0, 800,
600, 0, 0 ),
 w1txt = createEx(Label,"Press Escape to toggle",Window1,10,10,200,25,0,0)
integer hasTitleBar
	hasTitleBar=w32True

procedure Screen_keydown(integer Self, integer Event, sequence Params)
    if Params[1] = VK_ESCAPE then
	if hasTitleBar then
	    removeStyle(Window1,WS_BORDER)
	else
	    addStyle(Window1,WS_BORDER)
	end if
	hasTitleBar = not hasTitleBar
    end if
end procedure
setHandler(Screen, w32HKeyDown, routine_id("Screen_keydown"))

WinMain( Window1,Normal )

> I still am not sure what Arwen is. I have been reading on the forum a sort 
> of competition between win32lib and wxEuphoria. Where does Arwen fit into 
> that?
Arwen is smaller and faster than both, and windows-only unlike wxEuphoria. More
of a "bare bones" approach, that I find gives me more control. However it does
not contain routines like addStyle and removeStyle, so I code such things in
direct winAPI calls. Here is the above written using Arwen:
include arwen.ew
without warning

constant Window1 = create(Window, "Press Escape to toggle", 0, 0, 0, 0, 800,
600, 0),
 w1txt = create(Label,"Press Escape to toggle",0,Window1,10,10,200,25,0)
integer hasTitleBar
	hasTitleBar=True

function w1Handler(integer id, integer msg, atom wParam, object lParam)
atom style, w1Hwnd
    if msg = WM_KEYDOWN
    and wParam = VK_ESCAPE then
	w1Hwnd=getHwnd(Window1)
	style = c_func(xGetWindowLong,{w1Hwnd, GWL_STYLE })
	if hasTitleBar then
	    style-=and_bits(style,WS_BORDER)
	else
	    style=or_bits(style,WS_BORDER)
	end if
	void = c_func(xSetWindowLong,{w1Hwnd,GWL_STYLE,style})
	hasTitleBar = not hasTitleBar
	void = c_func(xSetWindowPos, {w1Hwnd, 0, 0, 0, 0, 0, SWP_UPDATECACHE})
    end if
    return 0
end function
setHandler(Window1, routine_id("w1Handler"))

WinMain( Window1, SW_NORMAL )

Obviously if I used such code often, I would create a standard routine for
Arwen, maybe I should.

Regards,
Pete

new topic     » goto parent     » topic index » view message » categorize

9. Re: Hiding the main MS Window Title Bar

I wrote:
> Here is the above written using Arwen:
Straight after posting I realised it could be further simplified:
include arwen.ew
without warning

constant Window1 = create(Window, "Press Escape to toggle", 0, 0, 0, 0, 800,
600, 0),
 w1txt = create(Label,"Press Escape to toggle",0,Window1,10,10,200,25,0),
 w1Hwnd=getHwnd(Window1)

function w1Handler(integer id, integer msg, atom wParam, object lParam)
atom style
    if msg = WM_KEYDOWN
    and wParam = VK_ESCAPE then
	style = c_func(xGetWindowLong,{w1Hwnd, GWL_STYLE })
	style = xor_bits(style,WS_BORDER)
	void = c_func(xSetWindowLong,{w1Hwnd,GWL_STYLE,style})
	void = c_func(xSetWindowPos,{w1Hwnd,0,0,0,0,0,SWP_UPDATECACHE})
    end if
    return 0
end function
setHandler(Window1, routine_id("w1Handler"))

WinMain( Window1, SW_NORMAL )


Regards,
Pete

new topic     » goto parent     » topic index » view message » categorize

10. Re: Hiding the main MS Window Title Bar

Pete Lomax wrote:
> 
> I wrote:
> > Here is the above written using Arwen:
> Straight after posting I realised it could be further simplified:
> }}}
<eucode>
> include arwen.ew
> without warning
> 
> constant Window1 = create(Window, "Press Escape to toggle", 0, 0, 0, 0, 800,
> 600, 0),
>  w1txt = create(Label,"Press Escape to toggle",0,Window1,10,10,200,25,0),
>  w1Hwnd=getHwnd(Window1)
> 
> function w1Handler(integer id, integer msg, atom wParam, object lParam)
> atom style
>     if msg = WM_KEYDOWN
>     and wParam = VK_ESCAPE then
> 	style = c_func(xGetWindowLong,{w1Hwnd, GWL_STYLE })
> 	style = xor_bits(style,WS_BORDER)
> 	void = c_func(xSetWindowLong,{w1Hwnd,GWL_STYLE,style})
> 	void = c_func(xSetWindowPos,{w1Hwnd,0,0,0,0,0,SWP_UPDATECACHE})
>     end if
>     return 0
> end function
> setHandler(Window1, routine_id("w1Handler"))
> 
> WinMain( Window1, SW_NORMAL )
> </eucode>
{{{

> 
> Regards,
> Pete

I like this stuff. However, it does not work until you add:

SWP_NOSIZE = 1, SWP_NOMOVE = 2, SWP_NOZORDER = 4,  SWP_FRAMECHANGED  = #0020,
 SWP_UPDATECACHE    = SWP_NOSIZE+SWP_NOMOVE+SWP_NOZORDER+SWP_FRAMECHANGED

And I would have NO idea what this stuff is, and I only found it by grep and
seeing it was in win32lib. This proves a point. That if someone wants to program
in Windows and is not already a Windows expert, it is best to use win32lib. I
picked win32lib (and Euphoria by extension) because I found the IDE for it.

Andy Katz

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

new topic     » goto parent     » topic index » view message » categorize

11. Re: Hiding the main MS Window Title Bar

Andrew Katz wrote:
> This proves a point. That if someone wants to program
> in Windows and is not already a Windows expert, it is best to use win32lib.
No argument whatsoever here.
I cut my teeth on win32lib. It is very good. All I say is that at some point I
felt it time to move on, and the "hiding most of the guts" of the winAPI was
something I needed to leave behind, to learn more.

Regards,
Pete

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu