Hallo!
Wie kann ich mit VisualBasic den Computernamen aus der Registry (oder sonst woher) auslesen (Windows NT)?
Nachtrag
Archive wie regapi.zip o.ä. habe ich schon gefunden, daß ist mir aber viel zu kompliziert (das raffe ich nicht)… ich will einfach nur sowas:
PCName$ = getRegKey(„HKEY_LOCAL_MACHINE…\KEY“)
Hallo!
Wie kann ich mit VisualBasic den
Computernamen aus der Registry (oder
sonst woher) auslesen (Windows NT)?
Private Declare Function GetComputerName Lib "kernel32" \_
Alias "GetComputerNameA" (ByVal lpBuffer As String, nSize As Long) As Long
Private Const MAX\_COMPUTERNAME\_LENGTH As Long = 15&
Public Function CurrentMachineName() As String
Dim lSize As Long
Dim sBuffer As String
sBuffer = Space$(MAX\_COMPUTERNAME\_LENGTH + 1)
lSize = Len(sBuffer)
If GetComputerName(sBuffer, lSize) Then CurrentMachineName = left$(sBuffer, lSize)
End Function
Reinhard
Danke!
Funktioniert! Genau sowas habe ich gesucht. Was kann die „kernel32“ Biblothek denn noch so alles?
Was kann die „kernel32“
Biblothek denn noch so alles?
Nun ja - sie ist halt ein wesentlicher Teil der Windows-API und enthält einige 400 systemnahe Funktionen, z.B.:
AddAtom, AllocConsole, BackupRead, BackupSeek, BackupWrite, Beep, BeginUpdateResource, BuildCommDCB, BuildCommDCBAndTimeouts, CallNamedPipe, ClearCommBreak, ClearCommError, CloseHandle, CommConfigDialog, CompareFileTime, CompareString, ConnectNamedPipe, ContinueDebugEvent, ConvertDefaultLocale, CopyFile, CreateConsoleScreenBuffer, CreateDirectory, CreateDirectoryEx, CreateEvent, CreateFile, CreateFileMapping, CreateIoCompletionPort, CreateMailslot, CreateMutex, CreateNamedPipe, CreatePipe, CreateProcess, CreateProcessAsUser, CreateRemoteThread, CreateSemaphore, CreateTapePartition, CreateThread, DebugActiveProcess, DebugBreak, DefineDosDevice, DeleteAtom, DeleteCriticalSection, DeleteFile, DeviceIoControl, DisableThreadLibraryCalls, DisconnectNamedPipe, DosDateTimeToFileTime, DuplicateHandle, EndUpdateResource, EnterCriticalSection, EnumCalendarInfo, EnumDateFormats, EnumResourceLanguages, EnumResourceNames, EnumResourceTypes, EnumSystemCodePages, EnumSystemLocales, EnumTimeFormats, EraseTape, EscapeCommFunc
tion, ExitProcess, ExitThread, ExpandEnvironmentStrings, FatalAppExit, FatalExit, FileTimeToDosDateTime, FileTimeToLocalFileTime, FileTimeToSystemTime, FillConsoleOutputAttribute, FillConsoleOutputCharacter, FindAtom, FindClose, FindCloseChangeNotification, FindFirstChangeNotification, FindFirstFile, FindNextChangeNotification, FindNextFile, FindResource, FindResourceEx, FlushConsoleInputBuffer, FlushFileBuffers, FlushInstructionCache, FlushViewOfFile, FoldString, FormatMessage, FreeConsole, FreeEnvironmentStrings, FreeLibrary, FreeLibraryAndExitThread, FreeResource, GenerateConsoleCtrlEvent, GetACP, GetAtomName, GetBinaryType, GetCommandLine, GetCommConfig, GetCommMask, GetCommModemStatus, GetCommProperties, GetCommState, GetCommTimeouts, GetCompressedFileSize, GetComputerName, GetConsoleCP, GetConsoleCursorInfo, GetConsoleMode, GetConsoleOutputCP, GetConsoleScreenBufferInfo, GetConsoleTitle, GetCPInfo, GetCurrencyFormat, GetCurrentDirectory, GetCurrentProcess, GetCurrentProcessId, GetCurrentThread, GetCurr
entThreadId, GetDateFormat, GetDefaultCommConfig, GetDiskFreeSpace, GetDriveType, GetEnvironmentStrings, GetEnvironmentVariable, GetExitCodeProcess, GetExitCodeThread, GetFileAttributes, GetFileInformationByHandle, GetFileSize, GetFileTime, GetFileType, GetFullPathName, GetHandleInformation, GetKernelObjectSecurity, GetLargestConsoleWindowSize, GetLastError, GetLocaleInfo, GetLocalTime, GetLogicalDrives, GetLogicalDriveStrings, GetMailslotInfo, GetModuleFileName, GetModuleHandle, GetNamedPipeHandleState, GetNamedPipeInfo, GetNumberFormat, GetNumberOfConsoleInputEvents, GetNumberOfConsoleMouseButtons, GetOEMCP, GetOverlappedResult, GetPriorityClass, GetPrivateProfileInt, GetPrivateProfileSection, GetPrivateProfileString, GetProcAddress, GetProcessAffinityMask, GetProcessHeap, GetProcessHeaps, GetProcessShutdownParameters, GetProcessTimes, GetProcessWorkingSetSize, GetProfileInt, GetProfileSection, GetProfileString, GetQueuedCompletionStatus, GetShortPathName, GetStartupInfo, GetStdHandle, GetStringTypeA, GetS
tringTypeEx, GetStringTypeW, GetSystemDefaultLangID, GetSystemDefaultLCID, GetSystemDirectory, GetSystemInfo, GetSystemPowerStatus, GetSystemTime, GetSystemTimeAdjustment, GetTapeParameters, GetTapePosition, GetTapeStatus, GetTempFileName, GetTempPath, GetThreadContext, GetThreadLocale, GetThreadPriority, GetThreadSelectorEntry, GetThreadTimes, GetTickCount, GetTimeFormat, GetTimeZoneInformation, GetUserDefaultLangID, GetUserDefaultLCID, GetVersion, GetVersionEx, GetVolumeInformation, GetWindowsDirectory, GlobalAddAtom, GlobalAlloc, GlobalCompact, GlobalDeleteAtom, GlobalFindAtom, GlobalFix, GlobalFlags, GlobalFree, GlobalGetAtomName, GlobalHandle, GlobalLock, GlobalMemoryStatus, GlobalReAlloc, GlobalSize, GlobalUnfix, GlobalUnlock, GlobalUnWire, GlobalWire, HeapAlloc, HeapCompact, HeapCreate, HeapDestroy, HeapFree, HeapLock, HeapReAlloc, HeapSize, HeapUnlock, HeapValidate, hread, hwrite, ImpersonateLoggedOnUser, InitAtomTable, InitializeCriticalSection, InterlockedDecrement, InterlockedExchange, Interlocked
Increment, IsBadCodePtr, IsBadHugeReadPtr, IsBadHugeWritePtr, IsBadReadPtr, IsBadStringPtr, IsBadWritePtr, IsDBCSLeadByte, IsDBCSLeadByte, IsValidCodePage, IsValidLocale, lclose, LCMapString, lcreat, LeaveCriticalSection, llseek, LoadLibrary, LoadLibraryEx, LoadModule, LoadResource, LocalAlloc, LocalCompact, LocalFileTimeToFileTime, LocalFlags, LocalFree, LocalHandle, LocalLock, LocalReAlloc, LocalShrink, LocalSize, LocalUnlock, LockFile, LockFileEx, LockResource, lopen, lread, lstrcat, lstrcmp, lstrcmpi, lstrcpy, lstrcpyn, lstrlen, lwrite, MapViewOfFile, MapViewOfFile, MapViewOfFileEx, MoveFile, MoveFileEx, MulDiv, MultiByteToWideChar, ObjectOpenAuditAlarm, OpenEvent, OpenFile, OpenFileMapping, OpenMutex, OpenProcess, OpenSemaphore, OutputDebugString, PeekNamedPipe, PrepareTape, PulseEvent, PurgeComm, QueryDosDevice, QueryPerformanceCounter, QueryPerformanceFrequency, RaiseException, ReadConsole, ReadConsoleOutput, ReadConsoleOutputAttribute, ReadConsoleOutputCharacter, ReadFile, ReadFileEx, ReadProcessMemo
ry, ReleaseMutex, ReleaseSemaphore, RemoveDirectory, ResetEvent, ResumeThread, ScrollConsoleScreenBuffer, SearchPath, SetCommBreak, SetCommConfig, SetCommMask, SetCommState, SetCommTimeouts, SetComputerName, SetConsoleActiveScreenBuffer, SetConsoleCP, SetConsoleCtrlHandler, SetConsoleCursorInfo, SetConsoleCursorPosition, SetConsoleMode, SetConsoleOutputCP, SetConsoleScreenBufferSize, SetConsoleTextAttribute, SetConsoleTitle, SetConsoleWindowInfo, SetCurrentDirectory, SetDefaultCommConfig, SetEndOfFile, SetEnvironmentVariable, SetErrorMode, SetEvent, SetFileApisToANSI, SetFileApisToOEM, SetFileAttributes, SetFilePointer, SetFileTime, SetHandleCount, SetHandleInformation, SetKernelObjectSecurity, SetLastError, SetLocaleInfo, SetLocalTime, SetMailslotInfo, SetNamedPipeHandleState, SetPriorityClass, SetProcessShutdownParameters, SetProcessWorkingSetSize, SetStdHandle, SetSystemPowerState, SetSystemTime, SetSystemTimeAdjustment, SetTapeParameters, SetTapePosition, SetThreadAffinityMask, SetThreadContext, SetThrea
dLocale, SetThreadPriority, SetTimeZoneInformation, SetUnhandledExceptionFilter, SetupComm, SetVolumeLabel, SizeofResource, Sleep, SleepEx, SuspendThread, SystemTimeToFileTime, SystemTimeToTzSpecificLocalTime, TerminateProcess, TerminateThread, TlsAlloc, TlsFree, TlsGetValue, TlsSetValue, TransactNamedPipe, TransmitCommChar, UnhandledExceptionFilter, UnlockFile, UnlockFileEx, UnmapViewOfFile, UpdateResource, VerLanguageName, VirtualAlloc, VirtualFree, VirtualLock, VirtualProtect, VirtualProtectEx, VirtualQuery, VirtualQueryEx, VirtualUnlock, WaitCommEvent, WaitForMultipleObjects, WaitForMultipleObjectsEx, WaitForSingleObject, WaitForSingleObjectEx, WaitNamedPipe, WideCharToMultiByte, WinExec, WriteConsole, WriteConsoleOutput, WriteConsoleOutputAttribute, WriteConsoleOutputCharacter, WriteFile, WriteFileEx, WritePrivateProfileSection, WritePrivateProfileString, WriteProcessMemory, WriteProfileSection, WriteProfileString, WriteTapemark
Reinhard