Not a Member Yet,
Click here to Register

ID: 213
Viewed: 2963
Added: Apr 29, 2002
Version:
Snippet uploaded by: snippet
Written By: unknown
Demo: Sorry, no demo



User Rated at: 0 Stars
Rate This:

Thank you for your vote. Please wait...

It appears you already voted for this snippet

It appears your vote value was empty

The code below allows you to create a Window which is OnTop, or normal, depending on what your application is. It does not respond when the title bar is double clicked for maximize/restore. A visible menu bar is also available. Form Properties necessary for this implementation: ------------------------------------------------- MaxButton False Disabled in the code Minbutton True/False Depending on the needs of the application ControlBox True Needed for maximize/restore to work WindowState Maximized To maximize the form on loading BorderStyle 0-None Disables Alt+F4 for closing application BorderStyle 1-Fixed Single Worked best for this application --------------------------------------------------------------------------- BorderStyle of 2-Sizable is not a good choice, because the frame of the window shows up when you double-click on the title bar.

Highlight all by clicking in box
<!---Declaration--->
Declare Sub SetWindowPos Lib "User" (ByVal hWnd As Integer, ByVal hWndInsertAfter As Integer,
ByVal X As Integer, ByVal Y As Integer, ByVal cx As Integer, ByVal cy As Integer, ByVal wflags
As Integer)

Declare Function GetSystemMenu Lib "User" (ByVal hWnd As Integer, ByVal bRevert As Integer) As
Integer

Declare Function DeleteMenu Lib "User" (ByVal hMenu As Integer, ByVal iditem As Integer, ByVal
wflags As Integer) As Integer



Const SC_SIZE = &HF000

Const SC_MOVE = &HF010

Const MF_BYCOMMAND = &H0

Highlight All
<!---Code--->
Sub Form_Load ()



Dim hMenu, iSuccess As Integer



'-------------------------------------------------------

' This will not allow the window to be moved or re-sized

'-------------------------------------------------------

hMenu = GetSystemMenu(Me.hWnd, 0)

iSuccess = DeleteMenu(hMenu, SC_SIZE, MF_BYCOMMAND)

iSuccess = DeleteMenu(hMenu, SC_MOVE, MF_BYCOMMAND)



'-----------------------------------------------------------------------

' This will set the Window to the size of the screen no matter what it

' is. If the user tries to double click the window, it will appear to

' not do anything, though it is in restored mode.

'-----------------------------------------------------------------------

Me.Height = Screen.Height + 45

Me.Width = Screen.Width + 60

Me.Left = -15

Me.Top = -15



'--------------------------------------------

' This will make the window always be visible

'--------------------------------------------

SetWindowPos Me.hWnd, -1, 0, 0, 0, 0, &H50


'----------------------------------------------------------------

' This will remove the always visible attribute, use where needed

'----------------------------------------------------------------

'SetWindowPos Me.hWnd, -2, 0, 0, 0, 0, &H50

End Sub;


No Comments to show

Please completely fill out the form below if you want to review this snippet. All reviews are subject to validation.


Replying to a Comment...


Adding your comment. Please wait...

Thanks for adding your comment!. After further review it will be added.

There was a problem adding your comment. Please try again.

Please complete all the fields in the form before sending.

© 2002 - 2024 snippetlibrary.com All Rights Reserved. Conditions
Do NOT follow this link or you will be banned from the site!