ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   form size and protection (https://www.excelbanter.com/excel-programming/328287-form-size-protection.html)

Liedson31

form size and protection
 
hi everyone, i need some help
i have a form that i want to display on fullscreen independent of screen
resolution(1024,800,....) i, want to show always on full screen...

the second question is, in this form i don“t want the user rezise it or move
it the form must be "locked" from any movement,the user only put values in
the boxes available.....

sorry about my english if it is not good

thanks in advance
Miguel


Vasant Nanavati

form size and protection
 
Try something like this (put it in the UserForm's code module):

Private Sub UserForm_Initialize()
With Application
Top = .Top
Height = .Height
Left = .Left
Width = .Width
End With
Dim lHandle As Long, lCount As Long
On Error Resume Next
lHandle = FindWindowA(vbNullString, Me.Caption)
If lHandle < 0 Then
For lCount = 1 To 6
DeleteMenu GetSystemMenu(lHandle, False), 0, MF_BYPOSITION
Next lCount
End If
End Sub

--

Vasant



"Liedson31" wrote in message
...
hi everyone, i need some help
i have a form that i want to display on fullscreen independent of screen
resolution(1024,800,....) i, want to show always on full screen...

the second question is, in this form i don“t want the user rezise it or

move
it the form must be "locked" from any movement,the user only put values in
the boxes available.....

sorry about my english if it is not good

thanks in advance
Miguel




Liedson31

form size and protection
 
thanks vasant

the with application... works fine but after the end with part,the
FindWindowA my excel don“t recognize it,gives me a "sub or function not
defined".it is a reference that i must insert? if it works what do the lines :
For lCount = 1 To 6
DeleteMenu GetSystemMenu(lHandle, False), 0, MF_BYPOSITION
Next lCount

thanks again for your help
Miguel


Try something like this (put it in the UserForm's code module):

Private Sub UserForm_Initialize()
With Application
Top = .Top
Height = .Height
Left = .Left
Width = .Width
End With
Dim lHandle As Long, lCount As Long
On Error Resume Next
lHandle = FindWindowA(vbNullString, Me.Caption)
If lHandle < 0 Then
For lCount = 1 To 6
DeleteMenu GetSystemMenu(lHandle, False), 0, MF_BYPOSITION
Next lCount
End If
End Sub

--

Vasant



"Liedson31" wrote in message
...
hi everyone, i need some help
i have a form that i want to display on fullscreen independent of screen
resolution(1024,800,....) i, want to show always on full screen...

the second question is, in this form i don“t want the user rezise it or

move
it the form must be "locked" from any movement,the user only put values in
the boxes available.....

sorry about my english if it is not good

thanks in advance
Miguel





Vasant Nanavati

form size and protection
 
I apologize; I forgot the declarations. Paste the following at the top of
your module:

Private Const MF_BYPOSITION As Long = &H400
Private Declare Function GetSystemMenu Lib "user32" _
(ByVal hWnd As Long, ByVal bRevert As Long) As Long
Private Declare Function DeleteMenu Lib "user32" _
(ByVal hMenu As Long, ByVal nPosition As Long, _
ByVal wFlags As Long) As Long
Private Declare Function FindWindowA Lib "user32" _
(ByVal lpClassName As String, ByVal lpWindowName _
As String) As Long

--

Vasant

"Liedson31" wrote in message
...
thanks vasant

the with application... works fine but after the end with part,the
FindWindowA my excel don“t recognize it,gives me a "sub or function not
defined".it is a reference that i must insert? if it works what do the

lines :
For lCount = 1 To 6
DeleteMenu GetSystemMenu(lHandle, False), 0, MF_BYPOSITION
Next lCount

thanks again for your help
Miguel


Try something like this (put it in the UserForm's code module):

Private Sub UserForm_Initialize()
With Application
Top = .Top
Height = .Height
Left = .Left
Width = .Width
End With
Dim lHandle As Long, lCount As Long
On Error Resume Next
lHandle = FindWindowA(vbNullString, Me.Caption)
If lHandle < 0 Then
For lCount = 1 To 6
DeleteMenu GetSystemMenu(lHandle, False), 0, MF_BYPOSITION
Next lCount
End If
End Sub

--

Vasant



"Liedson31" wrote in message
...
hi everyone, i need some help
i have a form that i want to display on fullscreen independent of

screen
resolution(1024,800,....) i, want to show always on full screen...

the second question is, in this form i don“t want the user rezise it

or
move
it the form must be "locked" from any movement,the user only put

values in
the boxes available.....

sorry about my english if it is not good

thanks in advance
Miguel







Liedson31

form size and protection
 
Sorry the time i took to reply.....but i've been "captured" by my boss for
another application and i put this one back....but once i“ve started it
again...i remember my earlier problem :)))))))

it works perfectly!!!

Thanks very much
Miguel

"Vasant Nanavati" wrote:

I apologize; I forgot the declarations. Paste the following at the top of
your module:

Private Const MF_BYPOSITION As Long = &H400
Private Declare Function GetSystemMenu Lib "user32" _
(ByVal hWnd As Long, ByVal bRevert As Long) As Long
Private Declare Function DeleteMenu Lib "user32" _
(ByVal hMenu As Long, ByVal nPosition As Long, _
ByVal wFlags As Long) As Long
Private Declare Function FindWindowA Lib "user32" _
(ByVal lpClassName As String, ByVal lpWindowName _
As String) As Long

--

Vasant

"Liedson31" wrote in message
...
thanks vasant

the with application... works fine but after the end with part,the
FindWindowA my excel don“t recognize it,gives me a "sub or function not
defined".it is a reference that i must insert? if it works what do the

lines :
For lCount = 1 To 6
DeleteMenu GetSystemMenu(lHandle, False), 0, MF_BYPOSITION
Next lCount

thanks again for your help
Miguel


Try something like this (put it in the UserForm's code module):

Private Sub UserForm_Initialize()
With Application
Top = .Top
Height = .Height
Left = .Left
Width = .Width
End With
Dim lHandle As Long, lCount As Long
On Error Resume Next
lHandle = FindWindowA(vbNullString, Me.Caption)
If lHandle < 0 Then
For lCount = 1 To 6
DeleteMenu GetSystemMenu(lHandle, False), 0, MF_BYPOSITION
Next lCount
End If
End Sub

--

Vasant



"Liedson31" wrote in message
...
hi everyone, i need some help
i have a form that i want to display on fullscreen independent of

screen
resolution(1024,800,....) i, want to show always on full screen...

the second question is, in this form i don“t want the user rezise it

or
move
it the form must be "locked" from any movement,the user only put

values in
the boxes available.....

sorry about my english if it is not good

thanks in advance
Miguel








Vasant Nanavati

form size and protection
 
Thanks for the feedback!

--

Vasant

"Liedson31" wrote in message
...
Sorry the time i took to reply.....but i've been "captured" by my boss for
another application and i put this one back....but once i“ve started it
again...i remember my earlier problem :)))))))

it works perfectly!!!

Thanks very much
Miguel

"Vasant Nanavati" wrote:

I apologize; I forgot the declarations. Paste the following at the top

of
your module:

Private Const MF_BYPOSITION As Long = &H400
Private Declare Function GetSystemMenu Lib "user32" _
(ByVal hWnd As Long, ByVal bRevert As Long) As Long
Private Declare Function DeleteMenu Lib "user32" _
(ByVal hMenu As Long, ByVal nPosition As Long, _
ByVal wFlags As Long) As Long
Private Declare Function FindWindowA Lib "user32" _
(ByVal lpClassName As String, ByVal lpWindowName _
As String) As Long

--

Vasant

"Liedson31" wrote in message
...
thanks vasant

the with application... works fine but after the end with part,the
FindWindowA my excel don“t recognize it,gives me a "sub or function

not
defined".it is a reference that i must insert? if it works what do the

lines :
For lCount = 1 To 6
DeleteMenu GetSystemMenu(lHandle, False), 0,

MF_BYPOSITION
Next lCount

thanks again for your help
Miguel


Try something like this (put it in the UserForm's code module):

Private Sub UserForm_Initialize()
With Application
Top = .Top
Height = .Height
Left = .Left
Width = .Width
End With
Dim lHandle As Long, lCount As Long
On Error Resume Next
lHandle = FindWindowA(vbNullString, Me.Caption)
If lHandle < 0 Then
For lCount = 1 To 6
DeleteMenu GetSystemMenu(lHandle, False), 0,

MF_BYPOSITION
Next lCount
End If
End Sub

--

Vasant



"Liedson31" wrote in message
...
hi everyone, i need some help
i have a form that i want to display on fullscreen independent of

screen
resolution(1024,800,....) i, want to show always on full screen...

the second question is, in this form i don“t want the user rezise

it
or
move
it the form must be "locked" from any movement,the user only put

values in
the boxes available.....

sorry about my english if it is not good

thanks in advance
Miguel










Liedson31

form size and protection
 
Hi again Vasant......
After all my problem is bigger!

the code you give me works fine like a told you yesterday,but i have another
problem:

my form is optimized to 1024x768,in this resolution she really display on
fullscreen,centered and works perfectly,but....2 situations:

1-if the resolution changes to 1280x... or higher the form works fine but
the only change i need to made is that the form isn“t centered...i already
have the form set in Startupposition - CenterScreen(Owner - i tried both),
but what really happen is that in the screen it increases the backcolor of
the form to the right and the form goes to the left ??? the increase of the
back color is no problem but the form menu goes to the left......it don“t
like it its possible to have it centered?

2-this one i believe is even more dificult....and if the user uses a 800x600
resolution..he can even see the whole form :)))

thanks again
Miguel

"Vasant Nanavati" wrote:

Thanks for the feedback!

--

Vasant

"Liedson31" wrote in message
...
Sorry the time i took to reply.....but i've been "captured" by my boss for
another application and i put this one back....but once i“ve started it
again...i remember my earlier problem :)))))))

it works perfectly!!!

Thanks very much
Miguel

"Vasant Nanavati" wrote:

I apologize; I forgot the declarations. Paste the following at the top

of
your module:

Private Const MF_BYPOSITION As Long = &H400
Private Declare Function GetSystemMenu Lib "user32" _
(ByVal hWnd As Long, ByVal bRevert As Long) As Long
Private Declare Function DeleteMenu Lib "user32" _
(ByVal hMenu As Long, ByVal nPosition As Long, _
ByVal wFlags As Long) As Long
Private Declare Function FindWindowA Lib "user32" _
(ByVal lpClassName As String, ByVal lpWindowName _
As String) As Long

--

Vasant

"Liedson31" wrote in message
...
thanks vasant

the with application... works fine but after the end with part,the
FindWindowA my excel don“t recognize it,gives me a "sub or function

not
defined".it is a reference that i must insert? if it works what do the
lines :
For lCount = 1 To 6
DeleteMenu GetSystemMenu(lHandle, False), 0,

MF_BYPOSITION
Next lCount

thanks again for your help
Miguel


Try something like this (put it in the UserForm's code module):

Private Sub UserForm_Initialize()
With Application
Top = .Top
Height = .Height
Left = .Left
Width = .Width
End With
Dim lHandle As Long, lCount As Long
On Error Resume Next
lHandle = FindWindowA(vbNullString, Me.Caption)
If lHandle < 0 Then
For lCount = 1 To 6
DeleteMenu GetSystemMenu(lHandle, False), 0,

MF_BYPOSITION
Next lCount
End If
End Sub

--

Vasant



"Liedson31" wrote in message
...
hi everyone, i need some help
i have a form that i want to display on fullscreen independent of
screen
resolution(1024,800,....) i, want to show always on full screen...

the second question is, in this form i don“t want the user rezise

it
or
move
it the form must be "locked" from any movement,the user only put
values in
the boxes available.....

sorry about my english if it is not good

thanks in advance
Miguel












All times are GMT +1. The time now is 02:34 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com