?
Solved

Removing Title bar from a Main Window

Posted on 2006-05-18
7
Medium Priority
?
1,766 Views
Last Modified: 2013-12-26
how do you remove the title bar from a main window in windows?

0
Comment
Question by:Omnipower
5 Comments
 
LVL 8

Expert Comment

by:gajender_99
ID: 16708328
conver the window to child window and untick the titlebar in  properties of the window.

Gajender
0
 

Author Comment

by:Omnipower
ID: 16708447
please do not post such simple replies - I would have to be rather stupid not to know that a child window does not have to have a title - you get 0 points!

I am talking about removing the title bar from a main window - I am expecting that this will require a Windows SDK call
0
 
LVL 6

Accepted Solution

by:
tr1l0b1t earned 500 total points
ID: 16716515
Save below code as .srw, and import it in PB.
You'll have a main window without titlebar (by Philip Salgannik)
---------------------------------------------------------------------------------

$PBExportHeader$w_main_nocaption.srw
forward
global type w_main_nocaption from window
end type
type cb_1 from commandbutton within w_main_nocaption
end type
end forward

global type w_main_nocaption from window
boolean visible = false
integer x = 672
integer y = 268
integer width = 2107
integer height = 1384
boolean titlebar = true
string title = "Test  Window"
string menuname = "m_main"
boolean controlmenu = true
boolean minbox = true
boolean maxbox = true
boolean resizable = true
long backcolor = 79741120
event ue_post_open ( )
cb_1 cb_1
end type
global w_main_nocaption w_main_nocaption

type prototypes
Function long GetWindowLongA (long hWindow, integer nIndex) Library "user32.dll"
Function long SetWindowLongA (long hWindow, integer nIndex, long dwNewLong) Library "user32.dll"
FUNCTION ulong GetSystemMenu(ulong hWnd, BOOLEAN bRevert)  Library "USER32"
FUNCTION boolean DeleteMenu( ulong hMenu, uint uPosition, uint uFlags ) LIBRARY "user32.dll"
FUNCTION boolean DrawMenuBar( ulong hWnd ) LIBRARY "user32.dll"

end prototypes

type variables
protected:
CONSTANT int GWL_STYLE  = -16
CONSTANT long  WS_THICKFRAME = 262144
CONSTANT long WS_SYSMENU = 524288
CONSTANT long WS_CAPTION = 12582912
CONSTANT long  WS_MINIMIZEBOX = 131072
CONSTANT long  WS_MAXIMIZEBOX = 65536
CONSTANT long  WS_OVERLAPPED = 0
CONSTANT long WS_BORDER = 8388608
CONSTANT long  WS_OVERLAPPEDWINDOW  = WS_OVERLAPPED + WS_CAPTION + WS_THICKFRAME + WS_SYSMENU + WS_MINIMIZEBOX +  WS_MAXIMIZEBOX
CONSTANT uint SC_SIZE         = 61440
CONSTANT uint SC_MOVE         = 61456
CONSTANT uint SC_MINIMIZE     = 61472
CONSTANT uint SC_MAXIMIZE     = 61488
CONSTANT uint SC_CLOSE        = 61536
CONSTANT uint SC_RESTORE      = 61728
CONSTANT uint MF_BYCOMMAND = 0
CONSTANT uint WM_SYSCOMMAND = 274
CONSTANT uint HTCAPTION = 2
CONSTANT uint WM_NCLBUTTONDOWN = 161
end variables

event ue_post_open();//  Description :            Force repaint etc.

Resize(width - 100, height -100 )
Resize(width + 100, height +100 )

Show()
end event
on w_main_nocaption.create
if this.MenuName = "m_main" then this.MenuID = create m_main
this.cb_1=create cb_1
this.Control[]={this.cb_1}
end on

on w_main_nocaption.destroy
if IsValid(MenuID) then destroy(MenuID)
destroy(this.cb_1)
end on

event open;ulong ll_style
ll_style = GetWindowLongA(handle(this), gwl_style)

IF ll_style > 0 THEN
      SetWindowLongA(handle(this), gwl_style, ll_style - WS_OVERLAPPEDWINDOW + WS_THICKFRAME)
END IF

// Get the window's menu
ULong    hMenu, hWnd

hWnd = Handle( this )
hMenu = GetSystemMenu( hWnd, FALSE )
IF hMenu > 0 THEN
      // removing the  menu items from the system menu
      
//      DeleteMenu( hMenu, SC_MINIMIZE , MF_BYCOMMAND)
//      DeleteMenu( hMenu, SC_MAXIMIZE , MF_BYCOMMAND)
//      DeleteMenu( hMenu, SC_RESTORE  , MF_BYCOMMAND)
      DeleteMenu( hMenu, SC_CLOSE  , MF_BYCOMMAND)
      // Force immediate menu update
//      DrawMenuBar( hWnd )
      
END IF

event post ue_post_open()

end event
event systemkey;IF key = keyf4! THEN
      message.processed = TRUE
      RETURN 0
END IF
end event

event mousemove;// fake Windows® into thinking that we clicked the title bar area
Post( Handle( this ), WM_NCLBUTTONDOWN, HTCAPTION, Long( xpos, ypos ) )

end event

type cb_1 from commandbutton within w_main_nocaption
integer x = 795
integer y = 972
integer width = 206
integer height = 92
integer taborder = 10
integer textsize = -10
integer weight = 400
fontcharset fontcharset = ansi!
fontpitch fontpitch = variable!
fontfamily fontfamily = swiss!
string facename = "Arial"
string text = "Close"
boolean default = true
end type

event clicked;Close(Parent)
end event
0
 
LVL 18

Assisted Solution

by:diasroshan
diasroshan earned 500 total points
ID: 16727763
Hi,

once uve saved the above contents as an .srw file, open it in notepad and search for the lines which have 'm_main'

ull find 2 lines... comment both lines... else ull get error in importing...

Cheers,
Rosh
0
 
LVL 6

Expert Comment

by:tr1l0b1t
ID: 16728861
oopps ...thanks Rosh, it's true. I created 'm_main' to check how the window worked with it
since original object hadn't menu. I forgot remove it before exporting.
Regards
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Programmer's Notepad is, one of the best free text editing tools available, simply because the developers appear to have second-guessed every weird problem or issue a programmer is likely to run into. One of these problems is selecting and deleti…
Here is a helpful source code for C++ Builder programmers that allows you to manage and manipulate HTML content from C++ code, while also handling HTML events like onclick, onmouseover, ... Some objects defined and used in this source include: …
The viewer will learn how to synchronize PHP projects with a remote server in NetBeans IDE 8.0 for Windows.
The viewer will learn how to use and create new code templates in NetBeans IDE 8.0 for Windows.
Suggested Courses

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question