Cherche API...

SuperNoizo Messages postés 23 Date d'inscription dimanche 23 juin 2002 Statut Membre Dernière intervention 30 janvier 2005 - 23 juin 2002 à 16:36
SuperNoizo Messages postés 23 Date d'inscription dimanche 23 juin 2002 Statut Membre Dernière intervention 30 janvier 2005 - 24 juin 2002 à 18:50
Boujour à tous,
Je cherche un API qui me permetterais de mettre en gris la croix en haut à droite comme dans une boîte de message(msgbox).
Merci

2 réponses

Seb_d_angers Messages postés 155 Date d'inscription vendredi 2 novembre 2001 Statut Membre Dernière intervention 19 mai 2011
23 juin 2002 à 18:49
J'ai trouver ce qu'il te faut sur l'excellent site

http://docvb.free.fr/api.php
---------------------------------------------------------
Fonction DeleteMenu

Declare Function DeleteMenu Lib "user32" Alias "DeleteMenu" ( _
ByVal hMenu As Long, _
ByVal nPosition As Long, _
ByVal wFlags As Long) As Long
Versions :
. Windows 95/98 : Oui
. Windows NT : A partir de 3.1
. Windows 2000/XP : Oui

Description :
Permet de supprimer un élément de menu.
hMenu est le handle du menu à manipuler.
nPosition est la position du menu (ou sous-menu) qui sera supprimé.
wFlags est la méthode de repérage utilisée : MF_BYCOMMAND ou MF_BYPOSITION.

Exemple d'utilisation :

' Origine : fred - chapeaux.ronds@wanadoo.fr

' Le code qui suis permet de désactiver les boutons "X", "min", "max".
' Créer un nouveau projet vb et coller le code suivant dans
' "déclaration" puis essayer les trois boutons les uns après les autres
' (pour cela enlever l'apostrophe devant "no_min" et "no_max").

Option Explicit

Private Declare Function DeleteMenu Lib "user32" (ByVal _
hMenu As Long, ByVal nPosition As Long, _
ByVal wFlags As Long) As Long
Private Declare Function GetSystemMenu Lib "user32" (ByVal _
hwnd As Long, ByVal bRevert 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 SetWindowLong Lib "user32" Alias _
"SetWindowLongA" (ByVal hwnd As Long, ByVal _
nIndex As Long, ByVal dwNewLong As Long) As Long

Private Const GWL_STYLE = (-16)
Private Const MF_BYCOMMAND = &H0&
Private Const MF_BYPOSITION = &H400
Private Const SC_MINIMIZE = &HF020
Private Const SC_MAXIMIZE = &HF030
Private Const SC_CLOSE = 6
Private Const WS_MAXIMIZEBOX = &H10000
Private Const WS_MINIMIZEBOX = &H20000

Private Sub no_x()
' Désactiver X
Dim hMenu As Long, k As Long
hMenu = GetSystemMenu(hwnd, False)
k = DeleteMenu(hMenu, SC_CLOSE, MF_BYPOSITION)
End Sub

Private Sub no_min()
' Désactiver 'minimiser'
Dim hMenu As Long, k As Long
hMenu = GetSystemMenu(hwnd, False)
k = DeleteMenu(hMenu, SC_MINIMIZE, MF_BYCOMMAND)
k = GetWindowLong(hwnd, GWL_STYLE)
k = k Xor WS_MINIMIZEBOX
SetWindowLong hwnd, GWL_STYLE, k
End Sub

Private Sub no_max()
' Désactiver 'maximiser'
Dim hMenu As Long, k As Long
hMenu = GetSystemMenu(hwnd, False)
k = DeleteMenu(hMenu, SC_MAXIMIZE, MF_BYCOMMAND)
k = GetWindowLong(hwnd, GWL_STYLE)
k = k Xor WS_MAXIMIZEBOX
SetWindowLong hwnd, GWL_STYLE, k
End Sub

Private Sub Form_Load()
no_x
' no_min
' no_max
End Sub

*********************************
J'espère t'avoir aider
A+
Seb
http://www.programmez.org
0
SuperNoizo Messages postés 23 Date d'inscription dimanche 23 juin 2002 Statut Membre Dernière intervention 30 janvier 2005
24 juin 2002 à 18:50
Merci beaucoup!!!
0
Rejoignez-nous