Jerome
-
26 juin 2001 à 13:13
patricktoledano
Messages postés3Date d'inscriptionsamedi 5 mars 2005StatutMembreDernière intervention26 août 2007
-
26 août 2007 à 10:56
Cette discussion concerne un article du site. Pour la consulter dans son contexte d'origine, cliquez sur le lien ci-dessous.
patricktoledano
Messages postés3Date d'inscriptionsamedi 5 mars 2005StatutMembreDernière intervention26 août 2007 26 août 2007 à 10:56
Bonjour à tous
J'essaye de convertir ce code en VBA pour MS/Access.....
J'ai remplacé le N° de thread de ma form par 0 car je ne le connais pas. J'i des résultats variables et surprenants (dans la win de access, n'importe où dans ma forme...). Je souhaite mes propres icones/images en liau et place des boutons standards (et non un "x") ou tout autre caractère.
D'autre part, je souhaite complètement "customisé" la barre de tittre de ma forme en remplaçant les boutons d'origine uniquement pour cette forme et de plus une image à la place du "fond" de barre de titre standard XP.
Par ailleurs, ma forme est sans bard car j'utilise le GDI pour cela (coins arrondis).
cs_DARKSIDIOUS
Messages postés15814Date d'inscriptionjeudi 8 août 2002StatutMembreDernière intervention 4 mars 2013130 5 févr. 2005 à 13:44
Pour ceux qui veulent la même chose, mais qui gère bien les thèmes XP, et qui est compatible avec toutes les versions de Windows :
cs_dalefou
Messages postés3Date d'inscriptionvendredi 23 juillet 2004StatutMembreDernière intervention24 août 2004 26 oct. 2004 à 15:38
Bonjour,
je suis plus que débutant en VB et j'ai donc bien réussi à faire apparaitre le bouton, mais je ne comprend pas comment lui associer une action ?
Merci d'avance de votre aide !!
cs_Fraggy
Messages postés95Date d'inscriptionlundi 9 juin 2003StatutMembreDernière intervention 2 juin 2010 10 juil. 2003 à 00:53
Je confirme, j'ai testé ce code sous WinXP et il ne fonctionne pas avec WinXP. Peut etre est-il nickel sous les autres OS. Domage que personne n'ai encore pensé a l'adapter pou XP. Merci quand à max12
pour le code et a flint pour la correction Bien que je ne puisse pas utiliser ce code, 8/10 ;)
psy4meuh
Messages postés23Date d'inscriptionjeudi 5 juin 2003StatutMembreDernière intervention23 août 2006 30 juin 2003 à 13:10
Cool cool !
Marche Nockel, bien pratique!
warwolf7
Messages postés43Date d'inscriptionsamedi 1 mars 2003StatutMembreDernière intervention31 mars 2004 29 avril 2003 à 22:30
oubliez ce code si vous avez win XP
cs_cyrilp
Messages postés140Date d'inscriptionmercredi 4 octobre 2000StatutMembreDernière intervention12 août 2009 8 janv. 2002 à 17:28
C beau un bouton mais quand on clique dessus, il est censé faire koi?
nan, parceque les 3 boutton habituel sont preprogramm és pour fermer, retrecir et redimetionner mais celui là??
Z'êtes vraiment nazes !
Voilà le code (2 corrections en tout ! Z'êtes vraiment m*******)
Option Explicit
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 GetWindowRect Lib "user32" (ByVal hwnd As Long, lpRect As Rect) As Long
Private Declare Function GetParent Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function SetParent Lib "user32" (ByVal hWndChild As Long, ByVal hWndNewParent As Long) As Long
Private Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
Private Declare Function SetWindowsHookEx Lib "user32" Alias "SetWindowsHookExA" (ByVal idHook&, ByVal lpfn&, ByVal hmod&, ByVal dwThreadId&) As Long
Private Declare Function UnhookWindowsHookEx Lib "user32" (ByVal hHook&) As Long
Private Declare Function CreateWindowEx Lib "user32" Alias "CreateWindowExA" (ByVal dwExStyle As Long, ByVal lpClassName As String, ByVal lpWindowName As String, ByVal dwStyle As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hWndParent As Long, ByVal hMenu As Long, ByVal hInstance As Long, lpParam As Any) As Long
Private Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long
Private Type Rect
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Private Type CWPSTRUCT
lParam As Long
wParam As Long
Message As Long
hwnd As Long
End Type
Const WM_MOVE = &H3
Const WM_SETCURSOR = &H20
Const WM_NCPAINT = &H85
Const WM_COMMAND = &H111
Const SWP_FRAMECHANGED = &H20
Const GWL_EXSTYLE = -20
Private WHook&
Private ButtonHwnd As Long
Public laFrm As Form
Public Sub InstallBouton()
ButtonHwnd& = CreateWindowEx(0&, "Button", "*", &H40000000, 50, 50, 14, 14, laFrm.hwnd, 0&, App.hInstance, 0&)
Call ShowWindow(ButtonHwnd&, 1)
WHook = SetWindowsHookEx(4, AddressOf HookProc, 0, App.ThreadID)
Call SetWindowLong(ButtonHwnd&, GWL_EXSTYLE, &H80)
Call SetParent(ButtonHwnd&, GetParent(laFrm.hwnd))
End Sub
Public Sub DesinstallBouton()
Call UnhookWindowsHookEx(WHook)
Call SetParent(ButtonHwnd&, laFrm.hwnd)
End Sub
Private Function HookProc&(ByVal nCode&, ByVal wParam&, Inf As CWPSTRUCT)
Dim FormRect As Rect
Static LastParam&
If Inf.hwnd = GetParent(ButtonHwnd&) Then
If Inf.Message = WM_COMMAND Then
Select Case LastParam
Case ButtonHwnd&: MsgBox "salut"
End Select
ElseIf Inf.Message = WM_SETCURSOR Then
LastParam = Inf.wParam
End If
ElseIf Inf.hwnd = laFrm.hwnd Then
If Inf.Message WM_NCPAINT Or Inf.Message WM_MOVE Then
Call GetWindowRect(laFrm.hwnd, FormRect)
Call SetWindowPos(ButtonHwnd&, 0, FormRect.Right - 75, FormRect.Top + 6, 17, 14, SWP_FRAMECHANGED)
End If
End If
End Function
26 août 2007 à 10:56
J'essaye de convertir ce code en VBA pour MS/Access.....
J'ai remplacé le N° de thread de ma form par 0 car je ne le connais pas. J'i des résultats variables et surprenants (dans la win de access, n'importe où dans ma forme...). Je souhaite mes propres icones/images en liau et place des boutons standards (et non un "x") ou tout autre caractère.
D'autre part, je souhaite complètement "customisé" la barre de tittre de ma forme en remplaçant les boutons d'origine uniquement pour cette forme et de plus une image à la place du "fond" de barre de titre standard XP.
Par ailleurs, ma forme est sans bard car j'utilise le GDI pour cela (coins arrondis).
5 févr. 2005 à 13:44
http://www.vbfrance.com/code.aspx?id=27709
DarK Sidious
26 oct. 2004 à 15:38
je suis plus que débutant en VB et j'ai donc bien réussi à faire apparaitre le bouton, mais je ne comprend pas comment lui associer une action ?
Merci d'avance de votre aide !!
10 juil. 2003 à 00:53
pour le code et a flint pour la correction Bien que je ne puisse pas utiliser ce code, 8/10 ;)
30 juin 2003 à 13:10
Marche Nockel, bien pratique!
29 avril 2003 à 22:30
8 janv. 2002 à 17:28
17 août 2001 à 19:15
27 juin 2001 à 20:55
27 juin 2001 à 00:23
nan, parceque les 3 boutton habituel sont preprogramm és pour fermer, retrecir et redimetionner mais celui là??
@++
26 juin 2001 à 18:11
26 juin 2001 à 15:35
Voilà le code (2 corrections en tout ! Z'êtes vraiment m*******)
Option Explicit
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 GetWindowRect Lib "user32" (ByVal hwnd As Long, lpRect As Rect) As Long
Private Declare Function GetParent Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function SetParent Lib "user32" (ByVal hWndChild As Long, ByVal hWndNewParent As Long) As Long
Private Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
Private Declare Function SetWindowsHookEx Lib "user32" Alias "SetWindowsHookExA" (ByVal idHook&, ByVal lpfn&, ByVal hmod&, ByVal dwThreadId&) As Long
Private Declare Function UnhookWindowsHookEx Lib "user32" (ByVal hHook&) As Long
Private Declare Function CreateWindowEx Lib "user32" Alias "CreateWindowExA" (ByVal dwExStyle As Long, ByVal lpClassName As String, ByVal lpWindowName As String, ByVal dwStyle As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hWndParent As Long, ByVal hMenu As Long, ByVal hInstance As Long, lpParam As Any) As Long
Private Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long
Private Type Rect
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Private Type CWPSTRUCT
lParam As Long
wParam As Long
Message As Long
hwnd As Long
End Type
Const WM_MOVE = &H3
Const WM_SETCURSOR = &H20
Const WM_NCPAINT = &H85
Const WM_COMMAND = &H111
Const SWP_FRAMECHANGED = &H20
Const GWL_EXSTYLE = -20
Private WHook&
Private ButtonHwnd As Long
Public laFrm As Form
Public Sub InstallBouton()
ButtonHwnd& = CreateWindowEx(0&, "Button", "*", &H40000000, 50, 50, 14, 14, laFrm.hwnd, 0&, App.hInstance, 0&)
Call ShowWindow(ButtonHwnd&, 1)
WHook = SetWindowsHookEx(4, AddressOf HookProc, 0, App.ThreadID)
Call SetWindowLong(ButtonHwnd&, GWL_EXSTYLE, &H80)
Call SetParent(ButtonHwnd&, GetParent(laFrm.hwnd))
End Sub
Public Sub DesinstallBouton()
Call UnhookWindowsHookEx(WHook)
Call SetParent(ButtonHwnd&, laFrm.hwnd)
End Sub
Private Function HookProc&(ByVal nCode&, ByVal wParam&, Inf As CWPSTRUCT)
Dim FormRect As Rect
Static LastParam&
If Inf.hwnd = GetParent(ButtonHwnd&) Then
If Inf.Message = WM_COMMAND Then
Select Case LastParam
Case ButtonHwnd&: MsgBox "salut"
End Select
ElseIf Inf.Message = WM_SETCURSOR Then
LastParam = Inf.wParam
End If
ElseIf Inf.hwnd = laFrm.hwnd Then
If Inf.Message WM_NCPAINT Or Inf.Message WM_MOVE Then
Call GetWindowRect(laFrm.hwnd, FormRect)
Call SetWindowPos(ButtonHwnd&, 0, FormRect.Right - 75, FormRect.Top + 6, 17, 14, SWP_FRAMECHANGED)
End If
End If
End Function
26 juin 2001 à 15:11
26 juin 2001 à 13:13
1) Ne fonctionne pas en module de classe
2) la fonction Event ne fonctionne pas en module classique....
Le code a t'il etait tester ???