Ich habe ein Programm, das heißt "API-Guide". Es liest die verfügbaren API befehle auf meinem Rechner aus (derzeit ~925).
Nun möchte ich die Befehle ja auch selbst nutzen, ohne euch jedesmal fragen zu müssen.
Aber das Programm sagt nur, welche Parameter ein Befehl braucht, gibt auch eventuelle Konstanten an und so, aber da das Programm nicht PB-Optimiert ist, weiß ich nicht, wie ich die Befehele in PB verwenden kann.
Ich zeige es euch mal:
Ich suche und finde den Befehl "GetComputerName". Beschreibung lt. Programm:
So, dann gibt es noch verschiedene Registerkarten, auch reiter genannt. Das war grad die Registerkarte "Info". Register "Parameters" sagt mir dies:The GetComputerName function retrieves the computer name of the current system. This name is established at system startup, when it is initialized from the registry.
Da fängts schon an. Das ist nicht für PB. Wie müsste ich das in PB umwandeln? Ich weiß nur, dass der Befehl in PB ein _ am Ende haben muss.Declaration:
Declare Function GetComputerName Lib "kernel32" Alias "GetComputerNameA" (ByVal lpBuffer As String, nSize As Long) As Long
Parameters:
· lpBuffer
Points to a buffer to receive the null-terminated character string containing the computer name.
· nSize
Points to a variable that specifies the maximum size, in characters, of the buffer. This value should be large enough to contain MAX_COMPUTERNAME_LENGTH + 1 characters.
Die letzte Registerkarte ist "Example", sieht aber aus, wie Höhlenmalereien oder Hyroglyphen:
Code: Alles auswählen
'example by Donavon Kuhn (Donavon.Kuhn@Nextel.com)
Private Const MAX_COMPUTERNAME_LENGTH As Long = 31
Private Declare Function GetComputerName Lib "kernel32" Alias "GetComputerNameA" (ByVal lpBuffer As String, nSize As Long) As Long
Private Sub Form_Load()
Dim dwLen As Long
Dim strString As String
'Create a buffer
dwLen = MAX_COMPUTERNAME_LENGTH + 1
strString = String(dwLen, "X")
'Get the computer name
GetComputerName strString, dwLen
'get only the actual data
strString = Left(strString, dwLen)
'Show the computer name
MsgBox strString
End Sub