j'ai un petit probleme pour convertire les api que j'utilisais sous vb6 vers
vb.net
j'ai changé mes long en integer, mais il me souleve quand meme un probleme
dans cette fonction pour fair une enumeration, il me dit Integer n'es pa un
type delegate... chaque fosi que j'utilise un adresseof sur une api.
est ce que qq connais la maniere de declarer ou coder ces lignes ?
je vous en remerci,
bonne journée,
Sebastien
'---------------------------------
'Add this code to a form
Private Sub EnumLesObject()
'KPD-Team 2000
'URL: http://www.allapi.net/
'E-Mail: KPDTeam@Allapi.net
'Set the form's graphics mode to persistent
'call the Enumwindows-function
EnumWindows(AddressOf EnumWindowsProc, 0&)
End Sub
'Add this code to a module
Declare Function EnumWindows Lib "user32" (ByVal lpEnumFunc As Int32, ByVal
lParam As Int32) As Boolean
Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal
hwnd As Integer, ByVal lpString As String, ByVal cch As Integer) As Integer
Declare Function GetWindowTextLength Lib "user32" Alias
"GetWindowTextLengthA" (ByVal hwnd As Integer) As Integer
Public Function EnumWindowsProc(ByVal hwnd As Object, ByVal lParam As
Object) As Boolean
Cette action est irreversible, confirmez la suppression du commentaire ?
Signaler le commentaire
Veuillez sélectionner un problème
Nudité
Violence
Harcèlement
Fraude
Vente illégale
Discours haineux
Terrorisme
Autre
Eric Vernié [MS]
Bonjour Sebastien,
voici comment procéder :
1) tu créez le delegate comme ceci Public Delegate Function Rappel( _ ByVal hwnd As IntPtr, _ ByVal lParam As IntPtr) As Boolean
2) Tu declare EnumWindows avec comme 1er paramètre le delegate "Rappel"
Public Declare Function EnumWindows Lib "user32" ( _ ByVal lpEnumFunc As Rappel, _ ByVal lParam As IntPtr) As Boolean
3) Tu crées la méthode de rappel avec la signature du delegate
Private Function MaMethode( _ ByVal hwnd As IntPtr, _ ByVal lParam As IntPtr) As Boolean
'Ajoutes ton code ici Return True End Function
4) tu appels enumwindows comme ceci. EnumWindows(AddressOf MaMethode, 0&)
Bon Weekend
Eric Vernié Microsoft France
"Sebastien" a écrit dans le message de news: 420225c5$0$17081$
bonjour,
j'ai un petit probleme pour convertire les api que j'utilisais sous vb6 vers vb.net
j'ai changé mes long en integer, mais il me souleve quand meme un probleme dans cette fonction pour fair une enumeration, il me dit Integer n'es pa un type delegate... chaque fosi que j'utilise un adresseof sur une api.
est ce que qq connais la maniere de declarer ou coder ces lignes ?
je vous en remerci,
bonne journée,
Sebastien
'---------------------------------
'Add this code to a form
Private Sub EnumLesObject()
'KPD-Team 2000
'URL: http://www.allapi.net/
'E-Mail:
'Set the form's graphics mode to persistent
'call the Enumwindows-function
EnumWindows(AddressOf EnumWindowsProc, 0&)
End Sub
'Add this code to a module
Declare Function EnumWindows Lib "user32" (ByVal lpEnumFunc As Int32, ByVal lParam As Int32) As Boolean
Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hwnd As Integer, ByVal lpString As String, ByVal cch As Integer) As Integer
Declare Function GetWindowTextLength Lib "user32" Alias "GetWindowTextLengthA" (ByVal hwnd As Integer) As Integer
Public Function EnumWindowsProc(ByVal hwnd As Object, ByVal lParam As Object) As Boolean
Dim sSave As String, Ret As Integer
Ret = GetWindowTextLength(hwnd)
sSave = Space(Ret)
GetWindowText(hwnd, sSave, Ret + 1)
Console.WriteLine(Str$(hwnd) + " " + sSave)
'continue enumeration
EnumWindowsProc = True
End Function
'---------------------------------
Bonjour Sebastien,
voici comment procéder :
1) tu créez le delegate comme ceci
Public Delegate Function Rappel( _
ByVal hwnd As IntPtr, _
ByVal lParam As IntPtr) As Boolean
2) Tu declare EnumWindows avec comme 1er paramètre le delegate "Rappel"
Public Declare Function EnumWindows Lib "user32" ( _
ByVal lpEnumFunc As Rappel, _
ByVal lParam As IntPtr) As Boolean
3) Tu crées la méthode de rappel avec la signature du delegate
Private Function MaMethode( _
ByVal hwnd As IntPtr, _
ByVal lParam As IntPtr) As Boolean
'Ajoutes ton code ici
Return True
End Function
4) tu appels enumwindows comme ceci.
EnumWindows(AddressOf MaMethode, 0&)
Bon Weekend
Eric Vernié
Microsoft France
"Sebastien" <info@nospam.europenv.com> a écrit dans le message de news:
420225c5$0$17081$626a14ce@news.free.fr...
bonjour,
j'ai un petit probleme pour convertire les api que j'utilisais sous vb6
vers vb.net
j'ai changé mes long en integer, mais il me souleve quand meme un probleme
dans cette fonction pour fair une enumeration, il me dit Integer n'es pa
un type delegate... chaque fosi que j'utilise un adresseof sur une api.
est ce que qq connais la maniere de declarer ou coder ces lignes ?
je vous en remerci,
bonne journée,
Sebastien
'---------------------------------
'Add this code to a form
Private Sub EnumLesObject()
'KPD-Team 2000
'URL: http://www.allapi.net/
'E-Mail: KPDTeam@Allapi.net
'Set the form's graphics mode to persistent
'call the Enumwindows-function
EnumWindows(AddressOf EnumWindowsProc, 0&)
End Sub
'Add this code to a module
Declare Function EnumWindows Lib "user32" (ByVal lpEnumFunc As Int32,
ByVal lParam As Int32) As Boolean
Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal
hwnd As Integer, ByVal lpString As String, ByVal cch As Integer) As
Integer
Declare Function GetWindowTextLength Lib "user32" Alias
"GetWindowTextLengthA" (ByVal hwnd As Integer) As Integer
Public Function EnumWindowsProc(ByVal hwnd As Object, ByVal lParam As
Object) As Boolean
1) tu créez le delegate comme ceci Public Delegate Function Rappel( _ ByVal hwnd As IntPtr, _ ByVal lParam As IntPtr) As Boolean
2) Tu declare EnumWindows avec comme 1er paramètre le delegate "Rappel"
Public Declare Function EnumWindows Lib "user32" ( _ ByVal lpEnumFunc As Rappel, _ ByVal lParam As IntPtr) As Boolean
3) Tu crées la méthode de rappel avec la signature du delegate
Private Function MaMethode( _ ByVal hwnd As IntPtr, _ ByVal lParam As IntPtr) As Boolean
'Ajoutes ton code ici Return True End Function
4) tu appels enumwindows comme ceci. EnumWindows(AddressOf MaMethode, 0&)
Bon Weekend
Eric Vernié Microsoft France
"Sebastien" a écrit dans le message de news: 420225c5$0$17081$
bonjour,
j'ai un petit probleme pour convertire les api que j'utilisais sous vb6 vers vb.net
j'ai changé mes long en integer, mais il me souleve quand meme un probleme dans cette fonction pour fair une enumeration, il me dit Integer n'es pa un type delegate... chaque fosi que j'utilise un adresseof sur une api.
est ce que qq connais la maniere de declarer ou coder ces lignes ?
je vous en remerci,
bonne journée,
Sebastien
'---------------------------------
'Add this code to a form
Private Sub EnumLesObject()
'KPD-Team 2000
'URL: http://www.allapi.net/
'E-Mail:
'Set the form's graphics mode to persistent
'call the Enumwindows-function
EnumWindows(AddressOf EnumWindowsProc, 0&)
End Sub
'Add this code to a module
Declare Function EnumWindows Lib "user32" (ByVal lpEnumFunc As Int32, ByVal lParam As Int32) As Boolean
Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hwnd As Integer, ByVal lpString As String, ByVal cch As Integer) As Integer
Declare Function GetWindowTextLength Lib "user32" Alias "GetWindowTextLengthA" (ByVal hwnd As Integer) As Integer
Public Function EnumWindowsProc(ByVal hwnd As Object, ByVal lParam As Object) As Boolean
Dim sSave As String, Ret As Integer
Ret = GetWindowTextLength(hwnd)
sSave = Space(Ret)
GetWindowText(hwnd, sSave, Ret + 1)
Console.WriteLine(Str$(hwnd) + " " + sSave)
'continue enumeration
EnumWindowsProc = True
End Function
'---------------------------------
Sebastien
merci, merci !!!!!! ++ seb
"Eric Vernié [MS]" a écrit dans le message de news:
Bonjour Sebastien,
voici comment procéder :
1) tu créez le delegate comme ceci Public Delegate Function Rappel( _ ByVal hwnd As IntPtr, _ ByVal lParam As IntPtr) As Boolean
2) Tu declare EnumWindows avec comme 1er paramètre le delegate "Rappel"
Public Declare Function EnumWindows Lib "user32" ( _ ByVal lpEnumFunc As Rappel, _ ByVal lParam As IntPtr) As Boolean
3) Tu crées la méthode de rappel avec la signature du delegate
Private Function MaMethode( _ ByVal hwnd As IntPtr, _ ByVal lParam As IntPtr) As Boolean
'Ajoutes ton code ici Return True End Function
4) tu appels enumwindows comme ceci. EnumWindows(AddressOf MaMethode, 0&)
Bon Weekend
Eric Vernié Microsoft France
"Sebastien" a écrit dans le message de news: 420225c5$0$17081$
bonjour,
j'ai un petit probleme pour convertire les api que j'utilisais sous vb6 vers vb.net
j'ai changé mes long en integer, mais il me souleve quand meme un probleme dans cette fonction pour fair une enumeration, il me dit Integer n'es pa un type delegate... chaque fosi que j'utilise un adresseof sur une api.
est ce que qq connais la maniere de declarer ou coder ces lignes ?
je vous en remerci,
bonne journée,
Sebastien
'---------------------------------
'Add this code to a form
Private Sub EnumLesObject()
'KPD-Team 2000
'URL: http://www.allapi.net/
'E-Mail:
'Set the form's graphics mode to persistent
'call the Enumwindows-function
EnumWindows(AddressOf EnumWindowsProc, 0&)
End Sub
'Add this code to a module
Declare Function EnumWindows Lib "user32" (ByVal lpEnumFunc As Int32, ByVal lParam As Int32) As Boolean
Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hwnd As Integer, ByVal lpString As String, ByVal cch As Integer) As Integer
Declare Function GetWindowTextLength Lib "user32" Alias "GetWindowTextLengthA" (ByVal hwnd As Integer) As Integer
Public Function EnumWindowsProc(ByVal hwnd As Object, ByVal lParam As Object) As Boolean
Dim sSave As String, Ret As Integer
Ret = GetWindowTextLength(hwnd)
sSave = Space(Ret)
GetWindowText(hwnd, sSave, Ret + 1)
Console.WriteLine(Str$(hwnd) + " " + sSave)
'continue enumeration
EnumWindowsProc = True
End Function
'---------------------------------
merci, merci !!!!!!
++
seb
"Eric Vernié [MS]" <ericv@online.microsoft.com> a écrit dans le message de
news: eTaepLuCFHA.3824@TK2MSFTNGP10.phx.gbl...
Bonjour Sebastien,
voici comment procéder :
1) tu créez le delegate comme ceci
Public Delegate Function Rappel( _
ByVal hwnd As IntPtr, _
ByVal lParam As IntPtr) As Boolean
2) Tu declare EnumWindows avec comme 1er paramètre le delegate "Rappel"
Public Declare Function EnumWindows Lib "user32" ( _
ByVal lpEnumFunc As Rappel, _
ByVal lParam As IntPtr) As Boolean
3) Tu crées la méthode de rappel avec la signature du delegate
Private Function MaMethode( _
ByVal hwnd As IntPtr, _
ByVal lParam As IntPtr) As Boolean
'Ajoutes ton code ici
Return True
End Function
4) tu appels enumwindows comme ceci.
EnumWindows(AddressOf MaMethode, 0&)
Bon Weekend
Eric Vernié
Microsoft France
"Sebastien" <info@nospam.europenv.com> a écrit dans le message de news:
420225c5$0$17081$626a14ce@news.free.fr...
bonjour,
j'ai un petit probleme pour convertire les api que j'utilisais sous vb6
vers vb.net
j'ai changé mes long en integer, mais il me souleve quand meme un
probleme dans cette fonction pour fair une enumeration, il me dit Integer
n'es pa un type delegate... chaque fosi que j'utilise un adresseof sur
une api.
est ce que qq connais la maniere de declarer ou coder ces lignes ?
je vous en remerci,
bonne journée,
Sebastien
'---------------------------------
'Add this code to a form
Private Sub EnumLesObject()
'KPD-Team 2000
'URL: http://www.allapi.net/
'E-Mail: KPDTeam@Allapi.net
'Set the form's graphics mode to persistent
'call the Enumwindows-function
EnumWindows(AddressOf EnumWindowsProc, 0&)
End Sub
'Add this code to a module
Declare Function EnumWindows Lib "user32" (ByVal lpEnumFunc As Int32,
ByVal lParam As Int32) As Boolean
Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal
hwnd As Integer, ByVal lpString As String, ByVal cch As Integer) As
Integer
Declare Function GetWindowTextLength Lib "user32" Alias
"GetWindowTextLengthA" (ByVal hwnd As Integer) As Integer
Public Function EnumWindowsProc(ByVal hwnd As Object, ByVal lParam As
Object) As Boolean
"Eric Vernié [MS]" a écrit dans le message de news:
Bonjour Sebastien,
voici comment procéder :
1) tu créez le delegate comme ceci Public Delegate Function Rappel( _ ByVal hwnd As IntPtr, _ ByVal lParam As IntPtr) As Boolean
2) Tu declare EnumWindows avec comme 1er paramètre le delegate "Rappel"
Public Declare Function EnumWindows Lib "user32" ( _ ByVal lpEnumFunc As Rappel, _ ByVal lParam As IntPtr) As Boolean
3) Tu crées la méthode de rappel avec la signature du delegate
Private Function MaMethode( _ ByVal hwnd As IntPtr, _ ByVal lParam As IntPtr) As Boolean
'Ajoutes ton code ici Return True End Function
4) tu appels enumwindows comme ceci. EnumWindows(AddressOf MaMethode, 0&)
Bon Weekend
Eric Vernié Microsoft France
"Sebastien" a écrit dans le message de news: 420225c5$0$17081$
bonjour,
j'ai un petit probleme pour convertire les api que j'utilisais sous vb6 vers vb.net
j'ai changé mes long en integer, mais il me souleve quand meme un probleme dans cette fonction pour fair une enumeration, il me dit Integer n'es pa un type delegate... chaque fosi que j'utilise un adresseof sur une api.
est ce que qq connais la maniere de declarer ou coder ces lignes ?
je vous en remerci,
bonne journée,
Sebastien
'---------------------------------
'Add this code to a form
Private Sub EnumLesObject()
'KPD-Team 2000
'URL: http://www.allapi.net/
'E-Mail:
'Set the form's graphics mode to persistent
'call the Enumwindows-function
EnumWindows(AddressOf EnumWindowsProc, 0&)
End Sub
'Add this code to a module
Declare Function EnumWindows Lib "user32" (ByVal lpEnumFunc As Int32, ByVal lParam As Int32) As Boolean
Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hwnd As Integer, ByVal lpString As String, ByVal cch As Integer) As Integer
Declare Function GetWindowTextLength Lib "user32" Alias "GetWindowTextLengthA" (ByVal hwnd As Integer) As Integer
Public Function EnumWindowsProc(ByVal hwnd As Object, ByVal lParam As Object) As Boolean