[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

phil hunt

12/20/2011 1:57:00 PM

Hi
Is there a way to disable 'title bar' click. basically, I want the form to
stay maximized.
I put in code in the resize event to max it, it works but it flash. Oh, I
don't want to make bordersize=0.

Thanks


15 Answers

DaveO

12/20/2011 4:36:00 PM

0

There are ways to do this but don't do it.

If I found a program that insisted on staying full screen it would be
deleted so quickly that superluminal neutrinos would seem slow.

Always allow your users to use their computer the way they want to. If you
want to make a full screen kiosk type application then you really shouldn't
have the title bar and if it's not a kiosk application then there is no
rational reason to force this. Also with the range of screen sizes available
now it could well look rubbish as not all screens are 3:4 anymore.

DaveO

"phil hunt" <a@abc.com> wrote in message
news:jcq46v$94d$1@speranza.aioe.org...
> Hi
> Is there a way to disable 'title bar' click. basically, I want the form to
> stay maximized.
> I put in code in the resize event to max it, it works but it flash. Oh, I
> don't want to make bordersize=0.
>
> Thanks
>


James Tyler

12/20/2011 4:57:00 PM

0

Never say never.
I can follow your rational. But there are hybrid where the PC is used mainly
for this particular app with occational web surfing in spare time. They can
minimize my app to do other stuff. I just don't want them to do half way.
People can normalise a form by mistake, but they never laern to max it by
mistake.
Btw, I have codes that stretch the form to fit the whole screen.

"DaveO" <djo@dial.pipex.com> wrote in message
news:jcqdgt$1v7$1@speranza.aioe.org...
> There are ways to do this but don't do it.
>
> If I found a program that insisted on staying full screen it would be
> deleted so quickly that superluminal neutrinos would seem slow.
>
> Always allow your users to use their computer the way they want to. If you
> want to make a full screen kiosk type application then you really
> shouldn't have the title bar and if it's not a kiosk application then
> there is no rational reason to force this. Also with the range of screen
> sizes available now it could well look rubbish as not all screens are 3:4
> anymore.
>
> DaveO
>
> "phil hunt" <a@abc.com> wrote in message
> news:jcq46v$94d$1@speranza.aioe.org...
>> Hi
>> Is there a way to disable 'title bar' click. basically, I want the form
>> to stay maximized.
>> I put in code in the resize event to max it, it works but it flash. Oh, I
>> don't want to make bordersize=0.
>>
>> Thanks
>>
>
>


Mike Williams

12/20/2011 6:00:00 PM

0

"Phil Hunt" <aaa@aaa.com> wrote in message
news:jcqeor$58v$1@speranza.aioe.org...
> Never say never.

Agreed. Basically you can do whatever you want as long as you believe that
your users will find it acceptable for that specific app. One way to prevent
the user from accidentally normalizing your Form is to subclass its Mouse
events and "eat" its NC Double Click event (a double click in the non client
area of the Form). The following code does exactly that, using the more or
less standard subclassing technique. With this method you need to make sure
that you obey the normal subclassing "rules" whilst developing your app (the
safest way is to simply comment out the Subclass code in the Load event
while you are developing the app in the VB IDE). There are other slightly
more complex "safer subclassing" ways of doing it, but this simple method
should be fine for your purposes. First set the WindowState to Maximized and
the MaxButton to False in the IDE properties and then paste the following
code into the Form's Load and Unload events:

Private Sub Form_Load()
SetMouseHook Me.hwnd
End Sub

Private Sub Form_Unload(Cancel As Integer)
ReleaseMouseHook
End Sub

Then create a new standard .bas module and paste the following code into the
module:

Option Explicit
Private Declare Function SetWindowsHookEx _
Lib "user32" Alias "SetWindowsHookExA" _
(ByVal idHook As Long, ByVal lpfn As Long, _
ByVal hmod As Long, ByVal dwThreadId As Long) As Long
Private Declare Function UnhookWindowsHookEx _
Lib "user32" (ByVal hHook As Long) As Long
Private Const WH_MOUSE As Long = 7
Private Declare Function CallNextHookEx _
Lib "user32" (ByVal hHook As Long, _
ByVal nCode As Long, ByVal wParam As Long, _
lParam As Any) As Long
Private Declare Sub CopyMemory Lib "kernel32" _
Alias "RtlMoveMemory" (Destination As Any, _
Source As Any, ByVal Length As Long)
Private Type POINTAPI
x As Long
y As Long
End Type
Private Type MOUSEHOOKSTRUCT
pt As POINTAPI
hwnd As Long
wHitTestCode As Long
dwExtraInfo As Long
End Type
Private mousedata As MOUSEHOOKSTRUCT
Private Hook As Long
Private HookedControl As Long
Private Const HC_ACTION = 0
Private Const WM_NCLBUTTONDBLCLK = &HA3

Public Sub SetMouseHook(Window As Long)
HookedControl = Window
If Hook = 0 Then
Hook = SetWindowsHookEx(WH_MOUSE, _
AddressOf MouseProc, App.hInstance, App.ThreadID)
End If
End Sub

Public Sub ReleaseMouseHook()
UnhookWindowsHookEx Hook
Hook = 0
End Sub

Private Function MouseProc(ByVal nCode As Long, _
ByVal wParam As Long, ByVal lParam As Long) As Long
If (nCode = HC_ACTION) And (wParam = WM_NCLBUTTONDBLCLK) Then
CopyMemory mousedata, ByVal lParam, Len(mousedata)
If mousedata.hwnd = HookedControl Then
MouseProc = -1 ' "eat" the message
Else
MouseProc = CallNextHookEx _
(0, nCode, wParam, ByVal lParam)
End If
Else
MouseProc = CallNextHookEx _
(0, nCode, wParam, ByVal lParam)
End If
End Function



James Tyler

12/20/2011 6:12:00 PM

0

Thanks, will give it a spin.


Dee Earley

12/21/2011 9:33:00 AM

0

On 20/12/2011 17:59, Mike Williams wrote:
> "Phil Hunt" <aaa@aaa.com> wrote in message
> news:jcqeor$58v$1@speranza.aioe.org...
>> Never say never.
>
> Agreed. Basically you can do whatever you want as long as you believe
> that your users will find it acceptable for that specific app. One way
> to prevent the user from accidentally normalizing your Form is to
> subclass its Mouse events and "eat" its NC Double Click event (a double
> click in the non client area of the Form).

Note that this won't stop the myriad of other ways of restoring a window
like:
Alt+Space, R
Right click, Restore
Right click taskbar icon, Restore
Dragging away from the screen edge (Win7+ only)
Task manager restore and tile/cascade
For the die hard, SetWindowPos(), ShowWindow(), and SetWindowPlacement()
etc.

You MAY have more luck eating the WM_SYSCOMMAND message when SC_RESTORE
is passed as wParam.

--
Deanna Earley (dee.earley@icode.co.uk)
i-Catcher Development Team
http://www.icode.co.uk...

iCode Systems

(Replies direct to my email address will be ignored.
Please reply to the group.)

Dee Earley

12/21/2011 9:36:00 AM

0

On 20/12/2011 17:59, Mike Williams wrote:
> "Phil Hunt" <aaa@aaa.com> wrote in message
> news:jcqeor$58v$1@speranza.aioe.org...
>> Never say never.
>
> Agreed. Basically you can do whatever you want as long as you believe
> that your users will find it acceptable for that specific app. One way
> to prevent the user from accidentally normalizing your Form is to
> subclass its Mouse events and "eat" its NC Double Click event (a double
> click in the non client area of the Form).

Note that this won't stop the myriad of other ways of restoring a window
like:
Alt+Space, R
Right click, Restore
Right click taskbar icon, Restore
Dragging away from the screen edge (Win7+ only)
Task manager restore and tile/cascade
For the die hard, SetWindowPos(), ShowWindow(), and SetWindowPlacement()
etc.

You MAY have more luck eating the WM_SYSCOMMAND message when SC_RESTORE
is passed as wParam.

--
Deanna Earley (dee.earley@icode.co.uk)
i-Catcher Development Team
http://www.icode.co.uk...

iCode Systems

(Replies direct to my email address will be ignored.
Please reply to the group.)

Mike Williams

12/21/2011 11:37:00 AM

0

"Deanna Earley" <dee.earley@icode.co.uk> wrote in message
news:jcs93k$vka$1@speranza.aioe.org...

> Note that this won't stop the myriad of other ways of
> restoring a window like:
> Alt+Space, R

Are you still upset about my pointing out that your i-Catcher software is
not dpi-aware and fails to declare itself as such, resulting in fuzzy text
on many machines? I didn't realise it had upset you so much. If I had known
how touchy you were I wouldn't have mentioned it :-)

Mike



Mike Williams

12/21/2011 11:39:00 AM

0

"Deanna Earley" <dee.earley@icode.co.uk> wrote in message
news:jcs998$vn2$1@speranza.aioe.org...

> Note that this won't stop the myriad of other ways of
> restoring a window like:
> Alt+Space, R

Are you still upset about my pointing out that your i-Catcher software is
not dpi-aware and fails to declare itself as such, resulting in fuzzy text
on many machines? I didn't realise it had upset you so much. If I had known
how touchy you were I wouldn't have mentioned it :-)

Mike

Dee Earley

12/21/2011 12:15:00 PM

0

On 21/12/2011 11:36, Mike Williams wrote:
> "Deanna Earley" <dee.earley@icode.co.uk> wrote in message
> news:jcs93k$vka$1@speranza.aioe.org...
>
>> Note that this won't stop the myriad of other ways of
>> restoring a window like:
>> Alt+Space, R
>
> Are you still upset about my pointing out that your i-Catcher software
> is not dpi-aware and fails to declare itself as such, resulting in fuzzy
> text on many machines? I didn't realise it had upset you so much. If I
> had known how touchy you were I wouldn't have mentioned it :-)

WTF does that have to do with anything?
I gave a solution that doesn't cover most cases.
I pointed out why and gave a better (but still not perfect) solution.

Nothing personal, you were just wrong :p

--
Deanna Earley (dee.earley@icode.co.uk)
i-Catcher Development Team
http://www.icode.co.uk...

iCode Systems

(Replies direct to my email address will be ignored.
Please reply to the group.)

Dee Earley

12/21/2011 12:21:00 PM

0

On 21/12/2011 12:15, Deanna Earley wrote:
> On 21/12/2011 11:36, Mike Williams wrote:
>> "Deanna Earley" <dee.earley@icode.co.uk> wrote in message
>> news:jcs93k$vka$1@speranza.aioe.org...
>>
>>> Note that this won't stop the myriad of other ways of
>>> restoring a window like:
>>> Alt+Space, R
>>
>> Are you still upset about my pointing out that your i-Catcher software
>> is not dpi-aware and fails to declare itself as such, resulting in fuzzy
>> text on many machines? I didn't realise it had upset you so much. If I
>> had known how touchy you were I wouldn't have mentioned it :-)
>
> WTF does that have to do with anything?
> I gave a solution that doesn't cover most cases.
> I pointed out why and gave a better (but still not perfect) solution.

Erm, yeah, you gave a partial solution even :)

--
Deanna Earley (dee.earley@icode.co.uk)
i-Catcher Development Team
http://www.icode.co.uk...

iCode Systems

(Replies direct to my email address will be ignored.
Please reply to the group.)