Userform ronde

dj_himp Messages postés 2 Date d'inscription jeudi 24 mars 2005 Statut Membre Dernière intervention 20 mai 2005 - 18 mai 2005 à 14:10
dj_himp Messages postés 2 Date d'inscription jeudi 24 mars 2005 Statut Membre Dernière intervention 20 mai 2005 - 20 mai 2005 à 08:25
Bonjour tout le monde.
j'ai un probleme, j'aimerai creer une userform ronde sous vba. j'ai chercher sur le forum des codes source et j'en ai trouvé (pour vb) mais je n'arrive pas a le faire fonctionner sous vba.

voila mon code :

Private Declare Function CreateEllipticRgn Lib "gdi32" (ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) As Long

Private Declare Function SetWindowRgn Lib "user32" (ByVal hWnd As Long, ByVal hRgn As Long, ByVal bRedraw As Boolean) As Long

Private Declare Function FindWindowA Lib "user32" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long


Private Declare Function DeleteObject Lib "gdi32" (ByVal hObject As Long) As Long


Public hWnd As Long
Public hRgn As Long


Private Sub UserForm_initialize()
hWnd = FindWindowA("", UserForm1.Caption)
hRgn = CreateEllipticRgn(0, 0, 300, 300)
SetWindowRgn hWnd, hRgn, True
DeleteObject (hRgn)
End Sub

2 réponses

Neo.balastik Messages postés 796 Date d'inscription jeudi 17 mai 2001 Statut Membre Dernière intervention 5 mai 2009 7
18 mai 2005 à 14:42
Salut ;O)

Il y a une erreur dans ton code :

remplace la ligne
hWnd = FindWindowA("", UserForm1.Caption)
par
hWnd = FindWindowA(vbNullString, UserForm1.Caption)

"" n'est pas égal à vbNullString

Guy
0
dj_himp Messages postés 2 Date d'inscription jeudi 24 mars 2005 Statut Membre Dernière intervention 20 mai 2005
20 mai 2005 à 08:25
Merci pour ta correction mais ma userform n'est toujours pas ronde, mais au moins j'ai appris quelque chose
0
Rejoignez-nous