ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   disable form movement (https://www.excelbanter.com/excel-programming/329001-disable-form-movement.html)

Liedson31

disable form movement
 
hi everyone

i know that is possible to disable form from any kind of movement.i don´t
want that the user can move,minimize,maximize,move from one position to
another, i want the form to be show always on fullscreen.i already disable
the close buttom and show the form on fullscreen but the user can move it.

how can i do it?

thanks in advance
Miguel



Michel Pierron

disable form movement
 
Hi Liedson31,
It is enough to remove the form title bar:
(not to forget a Exit button)

Private Declare Function FindWindow& _
Lib "user32" Alias "FindWindowA" _
(ByVal lpClassName$, ByVal lpWindowName$)
Private Declare Function SetWindowLong& _
Lib "user32" Alias "SetWindowLongA" _
(ByVal hWnd&, ByVal nIndex&, ByVal dwNewLong&)
Private Declare Function DrawMenuBar& _
Lib "user32" (ByVal hWnd&)

Private Sub UserForm_Initialize()
Dim hWnd As Long
hWnd = FindWindow(vbNullString, Me.Caption)
SetWindowLong hWnd, -16, &H84080080
DrawMenuBar hWnd
End Sub

MP

"Liedson31" a écrit dans le message de
news: ...
hi everyone

i know that is possible to disable form from any kind of movement.i don´t
want that the user can move,minimize,maximize,move from one position to
another, i want the form to be show always on fullscreen.i already disable
the close buttom and show the form on fullscreen but the user can move it.

how can i do it?

thanks in advance
Miguel





Liedson31

disable form movement
 
thanks michel that solves my problem!

"Michel Pierron" wrote:

Hi Liedson31,
It is enough to remove the form title bar:
(not to forget a Exit button)

Private Declare Function FindWindow& _
Lib "user32" Alias "FindWindowA" _
(ByVal lpClassName$, ByVal lpWindowName$)
Private Declare Function SetWindowLong& _
Lib "user32" Alias "SetWindowLongA" _
(ByVal hWnd&, ByVal nIndex&, ByVal dwNewLong&)
Private Declare Function DrawMenuBar& _
Lib "user32" (ByVal hWnd&)

Private Sub UserForm_Initialize()
Dim hWnd As Long
hWnd = FindWindow(vbNullString, Me.Caption)
SetWindowLong hWnd, -16, &H84080080
DrawMenuBar hWnd
End Sub

MP

"Liedson31" a écrit dans le message de
news: ...
hi everyone

i know that is possible to disable form from any kind of movement.i don´t
want that the user can move,minimize,maximize,move from one position to
another, i want the form to be show always on fullscreen.i already disable
the close buttom and show the form on fullscreen but the user can move it.

how can i do it?

thanks in advance
Miguel







All times are GMT +1. The time now is 02:15 PM.

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