COlive
Messages postés91Date d'inscriptionmercredi 27 février 2002StatutMembreDernière intervention 3 décembre 2011
-
21 janv. 2005 à 11:34
zippro4012
Messages postés216Date d'inscriptionmardi 15 juin 2004StatutMembreDernière intervention26 février 2006
-
23 janv. 2005 à 20:23
Bonjour,
je cherche le moyen d'utiliser des apis ou bien de les remplcer sous .net
voici le code qui fonctionne parfaitement en vb6 :
Public Function LitRemoteChaine(ByVal Nom_UNC_PC As String, ByVal hKey As Long, ByVal PathKey As String, ByVal ValueName As String) As String
Dim keyhand As Long
Dim RemoteHand As Long
Dim lValueType As Long
Dim lResult As Long
Dim strBuf As String
Dim lDataBufSize As Long
Dim intZeroPos As Integer
r = RegConnectRegistry(Nom_UNC_PC, hKey, RemoteHand)
r = RegOpenKey(RemoteHand, PathKey, keyhand)
lResult = RegQueryValueEx(keyhand, ValueName, 0&, lValueType, ByVal 0&, lDataBufSize) If lValueType REG_SZ Or lValueType REG_EXPAND_SZ Then
strBuf = String(lDataBufSize, " ")
lResult = RegQueryValueEx(keyhand, ValueName, 0&, 0&, ByVal strBuf, lDataBufSize)
If lResult = ERROR_SUCCESS Then
intZeroPos = InStr(strBuf, Chr$(0))
If intZeroPos > 0 Then
LitRemoteChaine = Left$(strBuf, intZeroPos - 1)
Else
LitRemoteChaine = strBuf
End If
End If
End If
r = RegCloseKey(keyhand)
r = RegCloseKey(RemoteHand)
End Function
La conversion en VB.NET ne fonctionne pas et malgrès plusieurs manipulation dans la déclaration des variables ou bien l'utilisation des fonctions, rien n'y fait.
Cette fonction permet à l'origine de lire une valeur chaine dans une base de registre d'un pc distant.
COlive.
Deux intellectuels assis iront moins loin qu'un con qui marche. Pensez-y !
cs_DARKSIDIOUS
Messages postés15814Date d'inscriptionjeudi 8 août 2002StatutMembreDernière intervention 4 mars 2013130 21 janv. 2005 à 11:53
Voir mon programme de visualisation d'API sur ProgOtoP.com (menu
POPAPI) : il te donnera les déclarations des fonctions de l'API Windows
en VB et en VB.NET !
DarK Sidious
Administrateur et reponsable VB/API du site www.ProgOtoP.com