Hades53
Messages postés231Date d'inscriptionmercredi 12 février 2003StatutMembreDernière intervention 7 juillet 2009
-
19 juil. 2005 à 15:06
cs_niky
Messages postés168Date d'inscriptionjeudi 28 juin 2001StatutMembreDernière intervention18 octobre 2008
-
10 août 2005 à 00:04
Bonjour,
j'ai un petit problème en VB .NET, la fonction Win32 GetClassName
bogue, apparement, d'autre fonctions comme GetWindowText (utilisé dans
le même processus bien sûr) boguent aussi.
J'essaye de faire un objet COM .NET, j'utilises des fonctions API Win
32 qui marchent bien, le problème est avec la fonction
GetClassName, quand je fais un GetLastError(), j'obtiens l'erreur 126
(The specified module could not be found)
voilà le code qui pose problème:
Public Class VUtil
Private Declare Function SBeep Lib "kernel32" Alias
"Beep" (ByVal duration As Int32, ByVal freq As Int32) As Boolean
Private Declare Function GetLastError Lib "kernel32" () As Long
Private Declare Function InetIsOffline Lib "url" Alias "InetIsOffline" (ByVal dwFlags As Long) As Long
Private Declare Function GetClassName Lib "user32"
Alias "GetClassNameA" (ByVal hwnd As Long, ByVal lpClassName As String,
ByVal nMaxCount As Long) As Long
Public Function Beep(ByVal duration As Int32, ByVal freq As Int32) As Boolean
If SBeep(duration, freq) Then
Beep = True
Else
Beep = False
End If
End Function
Public Function IsConnected() As String
If InetIsOffline(0) Then
IsConnected = "$true"
Else
IsConnected = "$false"
End If
End Function
Public Function GCN(ByVal handle As Long) As String
Dim buf As String
Dim ret As Long = 0
buf = Space$(64)
ret = GetClassName(handle, buf, 56)
Dim lol As String = GetLastError()
MsgBox("erreur: " + lol)
GCN = "class: " + Left(buf, ret)
End Function
Declare Function GetUserName Lib "advapi32.dll" Alias _
"GetUserNameA" (ByVal lpBuffer As String, ByRef nSize As Integer) As Integer