473,326 Members | 2,127 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

Double Clicking on Title Bar

Does anyone know how to disable the dbl click on the title bar?

I have a full screen progam that I dont want moved or closed or
anything. Took care of everything except for the fact that if you
double click on the title bar, the form sets itself to half size.

Can we disable that somehow??

Thanks!
David
Jul 17 '05 #1
7 8404
On Fri, 01 Jul 2005 05:43:27 GMT, schmendrick <sc*********@myway.com>
wrote:
Does anyone know how to disable the dbl click on the title bar?

I have a full screen progam that I dont want moved or closed or
anything. Took care of everything except for the fact that if you
double click on the title bar, the form sets itself to half size.

Can we disable that somehow??


One method is to intercept WM_SYSCOMMAND and burn off SC_RESTORE

unit Unit1;

// Keep Maximized 1/7/05 JF

interface

uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms,
Dialogs,
StdCtrls;

type
TForm1 = class(TForm)
procedure WMSysCommand(var Msg: TWMSysCommand); message
wm_SysCommand;
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;

implementation

{$R *.DFM}
procedure TForm1.WMSysCommand(var Msg: TWMSysCommand);
begin
If (Msg.CmdType And SC_RESTORE) = SC_RESTORE Then
Begin
msg.Result := 0;
Exit;
End;
Inherited;
end;

end.

Jul 17 '05 #2
On Fri, 1 Jul 2005 07:06:32 +0000 (UTC), er*****@nowhere.uk (J French)
wrote:
Whoops - wrong NG

But the general method should work
Jul 17 '05 #3
schmendrick wrote:
Does anyone know how to disable the dbl click on the title bar?

I have a full screen progam that I dont want moved or closed or
anything. Took care of everything except for the fact that if you
double click on the title bar, the form sets itself to half size.

Can we disable that somehow??

Thanks!
David

Do you need the titlebar? In a full-screen window, I can imagine you
want to drop it altogether. You should be able to do that with just form
properties.

Best regards
Jul 17 '05 #4


Dikkie Dik wrote:
schmendrick wrote:
Does anyone know how to disable the dbl click on the title bar?

Thanks!
David


Do you need the titlebar? In a full-screen window, I can imagine you
want to drop it altogether. You should be able to do that with just form
properties.

Best regards

Well, here's the weird thing about that... When I set it to full screen,
the status bar at the bottom is hidden by the taskbar. not a big deal,
i can handle that... BUT If I remove the title bar and run the app full
screen, it covers the taskbar, and I need that showing.
Jul 17 '05 #5

"schmendrick" <sc*********@myway.com> wrote in message
news:SY******************@tornado.ohiordc.rr.com.. .


Dikkie Dik wrote:
schmendrick wrote:
Does anyone know how to disable the dbl click on the title bar?

Thanks!
David


Do you need the titlebar? In a full-screen window, I can imagine you want to
drop it altogether. You should be able to do that with just form properties.

Best regards

Well, here's the weird thing about that... When I set it to full screen, the
status bar at the bottom is hidden by the taskbar. not a big deal, i can
handle that... BUT If I remove the title bar and run the app full screen, it
covers the taskbar, and I need that showing.


Try the handy and overlooked Microsoft SysInfo Control 6.0. It gives you the
work area of the desktop, and an event if it changes. Without a border, you need
some way to close the form, so I used a button.

Option Explicit

Private Sub Form_Load()
'set to no border
Me.BorderStyle = 0
'set initial size
SetSize
End Sub

Private Sub Command1_Click()
'no control box, so have something
Unload Me
End Sub

Private Sub SysInfo1_DisplayChanged()
'reset size if display changes
SetSize
End Sub

Private Sub SetSize()
'set size to system work area
With SysInfo1
Me.Move .WorkAreaLeft, .WorkAreaTop, _
.WorkAreaWidth, .WorkAreaHeight
End With
End Sub
Jul 17 '05 #6
PERFECT! Thanks!!!

Steve Gerrard wrote:

Dikkie Dik wrote:
schmendrick wrote:
Does anyone know how to disable the dbl click on the title bar?

Thanks!
David

Do you need the titlebar? In a full-screen window, I can imagine you want to
drop it altogether. You should be able to do that with just form properties.

Best regards


Well, here's the weird thing about that... When I set it to full screen, the
status bar at the bottom is hidden by the taskbar. not a big deal, i can
handle that... BUT If I remove the title bar and run the app full screen, it
covers the taskbar, and I need that showing.

Try the handy and overlooked Microsoft SysInfo Control 6.0. It gives you the
work area of the desktop, and an event if it changes. Without a border, you need
some way to close the form, so I used a button.

Option Explicit

Private Sub Form_Load()
'set to no border
Me.BorderStyle = 0
'set initial size
SetSize
End Sub

Private Sub Command1_Click()
'no control box, so have something
Unload Me
End Sub

Private Sub SysInfo1_DisplayChanged()
'reset size if display changes
SetSize
End Sub

Private Sub SetSize()
'set size to system work area
With SysInfo1
Me.Move .WorkAreaLeft, .WorkAreaTop, _
.WorkAreaWidth, .WorkAreaHeight
End With
End Sub

Jul 17 '05 #7
Here's another way to make the form immovable and imrestorable (TM).

'FORM CODE
-------------------------------------------
Option Explicit

Private Sub Form_Load()

'position form
Me.Move (Screen.Width - Me.Width) \ 2, (Screen.Height - Me.Height) \ 3

'nail form
If defWindowProc = 0 Then
Call SubClass(Me.hwnd)
End If

End Sub
Private Sub Form_Unload(Cancel As Integer)

If defWindowProc <> 0 Then
Call UnSubClass(Me.hwnd)
End If

End Sub

Private Sub Command1_Click() 'un-nail code

If defWindowProc <> 0 Then
Call UnSubClass(Me.hwnd)
End If

End Sub

'BAS MODULE CODE
-------------------------------------------

Option Explicit

Public Const GWL_WNDPROC As Long = (-4)
Public Const WM_NCHITTEST = &H84

Public defWindowProc As Long

Public Declare Function SetWindowLong Lib "user32" _
Alias "SetWindowLongA" _
(ByVal hwnd As Long, _
ByVal nIndex As Long, _
ByVal dwNewLong As Long) As Long

Public Declare Function CallWindowProc Lib "user32" _
Alias "CallWindowProcA" _
(ByVal lpPrevWndFunc As Long, _
ByVal hwnd As Long, _
ByVal uMsg As Long, _
ByVal wParam As Long, _
ByVal lParam As Long) As Long

Public Sub SubClass(hwnd As Long)

'assign our own window message
'procedure (WindowProc)
On Local Error Resume Next
defWindowProc = SetWindowLong(hwnd, _
GWL_WNDPROC, _
AddressOf WindowProc)

End Sub
Public Sub UnSubClass(hwnd As Long)

'restore the default message
'handling before exiting
On Local Error Resume Next
If defWindowProc Then
SetWindowLong hwnd, GWL_WNDPROC, defWindowProc
defWindowProc = 0
End If

End Sub
Public Function WindowProc(ByVal hwnd As Long, _
ByVal uMsg As Long, _
ByVal wParam As Long, _
ByVal lParam As Long) As Long

On Local Error Resume Next

Select Case hwnd

Case frmMain.hwnd

Select Case uMsg

Case WM_NCHITTEST:
WindowProc = 1
Exit Function

Case Else

End Select

End Select

WindowProc = CallWindowProc(defWindowProc, _
hwnd, _
uMsg, _
wParam, _
lParam)
End Function

--

Randy Birch
MS MVP Visual Basic
http://vbnet.mvps.org/
----------------------------------------------------------------------------
Read. Decide. Sign the petition to Microsoft.
http://classicvb.org/petition/
----------------------------------------------------------------------------

"schmendrick" <sc*********@myway.com> wrote in message
news:3K*******************@tornado.ohiordc.rr.com. ..
: Does anyone know how to disable the dbl click on the title bar?
:
: I have a full screen progam that I dont want moved or closed or
: anything. Took care of everything except for the fact that if you
: double click on the title bar, the form sets itself to half size.
:
: Can we disable that somehow??
:
: Thanks!
: David

Jul 17 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Display Name | last post by:
the customer I'm developing a site for uses a canned form-parsing page that allows her to have an email subscription opt-in page add emails to a list she can manage using a link that you point your...
1
by: Alex K. | last post by:
I am using combo box with DropDownStyle = simple. Tried to use double click event but it does not work. I've got this.comboItems.DoubleClick += new...
5
by: tshad | last post by:
I have been working with setting my drop boxes to allow double clicking to select an item. It worked fine until I made some changes. I then stripped the page down to the bare essentials to find...
3
by: Siv | last post by:
Hi, I have a ListView control in a Windows application, currently single clicking a customer name in this list, selects the customer and displays their details in text boxes to the right of the...
2
by: Siv | last post by:
Hi, I posted earlier in the week and no-one responded so i thought I would try again. My question is: I have a ListView control in a Windows application, currently single clicking a customer...
5
by: Nick | last post by:
Hey guys, I have 2 events on a windows forms datagrid, the mouse move as well as the double click events. What's happening is that when I double click on a row in the grid, the mouse move event...
1
by: JT | last post by:
Hi, I want to disable the ability to launch an application that is embedded in the text of a RichTextBox control. I've seen various posts that say that doing the following will disable click...
6
by: Jim Devenish | last post by:
I have an unbound form that displays all the days of the year as a calendar. It has 12 rows of text boxes with either 29,30 or 31 in each row. Text box names are of the form: display_01_01,...
2
by: Tom | last post by:
Double clicking the title bar to toggle a form between full screen size and the previous size is a great feature. Can someone please explain how to programmatically double click the title bar? ...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.