Newsgroup: it.comp.appl.access
Titolo: Access 2000 - Nascondere pulsanti di chiusura - riduzione - ingrandimento

Salve a tutti,
come da oggetto ...
... is it possible?
Grazie anticipatamente a tutti!
--
strano...mavero

 wrote in message
news:424ab...@x-privat.org

API obbligatorio metti tutta questa robaccia in un Modulo 
quindi chiama da dove vuoi :
Call ShowCloseBtn(True)
Call ShowCloseBtn(False)
'------------------- MODULO -----------------------------
Option Compare Database
Option Explicit
Private Const SW_HIDE = 0
Private Const SW_SHOWNORMAL = 1
Private Const SW_NORMAL = 1
Private Const SW_SHOWMINIMIZED = 2
Private Const SW_SHOWMAXIMIZED = 3
Private Const SW_MAXIMIZE = 3
Private Const SW_SHOWNOACTIVATE = 4
Private Const SW_SHOW = 5
Private Const SW_MINIMIZE = 6
Private Const SW_SHOWMINNOACTIVE = 7
Private Const SW_SHOWNA = 8
Private Const SW_RESTORE = 9
Private Const SW_SHOWDEFAULT = 10
Private Const SW_MAX = 10
Private Const GWL_STYLE = -16
Private Const WS_SYSMENU = &H80000
Private Const WM_NCPAINT = &H85
Private Declare Function SetWindowLong Lib "user32" _
 Alias "SetWindowLongA" (ByVal hWnd As Long, _
 ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Private Declare Function GetWindowLong Lib "user32" _
 Alias "GetWindowLongA" (ByVal hWnd As Long, _
 ByVal nIndex As Long) As Long
Private Declare Function apiFindWindow Lib "user32" Alias _
    "FindWindowA" (ByVal strClass As String, _
    ByVal lpWindow As String) As Long
Private Declare Function apiSendMessage Lib "user32" Alias _
    "SendMessageA" (ByVal hWnd As Long, ByVal Msg As Long, ByVal _
    wParam As Long, lParam As Long) As Long
 
Private Declare Function apiSetForegroundWindow Lib "user32" Alias _
    "SetForegroundWindow" (ByVal hWnd As Long) As Long
 
Private Declare Function apiShowWindow Lib "user32" Alias _
    "ShowWindow" (ByVal hWnd As Long, ByVal nCmdShow As Long) As Long
 
Private Declare Function apiIsIconic Lib "user32" Alias _
    "IsIconic" (ByVal hWnd As Long) As Long
 
Private Declare Function GetSystemMenu Lib "user32" (ByVal hWnd As Long,
_
         ByVal bRevert As Long) As Long
Private Declare Function GetMenuItemID Lib "user32" (ByVal hMenu As
Long, _
   ByVal nPos As Long) As Long
Private Declare Function RemoveMenu Lib "user32" (ByVal hMenu As Long, _
   ByVal nPosition As Long, ByVal wFlags As Long) As Long
Public Function ShowCloseBtn(ShowIt As Boolean)
    Dim mhWnd        As Long
    Dim lngOldStyle  As Long
    Dim lngNewStyle  As Long
 
    mhWnd = Application.hWndAccessApp
    ' Get the current window style of the form.
    lngOldStyle = GetWindowLong(mhWnd, GWL_STYLE)
 
    If ShowIt Then
        ' Turn on the bit that enables system menu.
        lngNewStyle = lngOldStyle Or WS_SYSMENU
    Else
        ' Turn off the bit the shows the system menu.
        lngNewStyle = lngOldStyle And Not WS_SYSMENU
    End If
    ' Questa Funzione suggerita da Maurizio Borrelli
    ' Serve per rimuovere anche il Menů POPUP della CaptionBar
    Call RemoveItem(mhWnd)
    ' Set the new window style.
    Call SetWindowLong(mhWnd, GWL_STYLE, lngNewStyle)
 
    ' The 1 as the third parameter tells
    ' the window to repaint its entire border.
    Call apiSendMessage(mhWnd, WM_NCPAINT, 1, 0)
ExitHere:
    Exit Function
HandleErrors:
    Select Case err.Number
        Case Else
            MsgBox err.Number & " " & err.Description
    End Select
    Resume ExitHere
End Function
Sub RemoveItem(hWnd As Long)
      Dim hMnu, y, i
      Const MF_BYPOSITION As Long = 1024
      Const MF_GRAYED As Long = 1
      Const MF_DISABLED As Long = 2
      hMnu = GetSystemMenu(hWnd, 0)
      For i = 6 To 0 Step -1
         y = RemoveMenu(hMnu, i, MF_BYPOSITION)
      Next i
End Sub
Ciao
@Alex
-- 
Posted via Mailgate.ORG Server - 
http://www.Mailgate.ORG

 strano...mavero
-- 
Roberto
-----------------------------------------------------
il Sito Comune di it.comp.appl.access
http://www.sitocomune.com
----------------------------------------------------

 Roberto
La seconda.
Deve impedire che Access possa essere ridotto ad icona.
Dovrà *obbligatoriamente* essere aperto o chiuso, ma *mai* iconizzato.
Saluti!

[cut]
ti ringrazio ma ... vale anche per la finestra di access?
Buona giornata.
--
strano...mavero

 wrote in message
news:424b9...@x-privat.org

Ovviamente la funzione sarebbe generalizzabile, ma se
dai un'occhiata al codice passo l'Handle fisso dell'applicativo
quindi di ACCESS.
Per poterlo applicare a qualsiasi Form inserisci un parametro
long e passa l'Hwnd della finestra sulla quale esercitare
l'azione.


 ha scritto nel messaggio
news:424b9...@x-privat.org...

Non conosco alcuna soluzione che non permetta di minimizzare l'applicativo,
ma solo soluzioni che inibiscono la possibilità di non minimizzare una
maschera o la finestra di Access.
