Sunday, March 9, 2014
Kernel32 Function
Get Computer Name
In a computer program, if you want to retrieve the computer system name you can use the 'GetComputerName' function available in the 'kernel32.dll' library. The following is an example of how to declare the function:Function long GetComputerName(ref String lpBuffer , long nSize ) Library 'kernel32.dll' Alias for 'GetComputerNameA'
System Directory
To retrieve the Windows system directory, such as 'C:\WINNT\system32,' you can use the 'GetSystemDirectory' function available in the 'kernel32.dll.' To use the function in a computer program you would declare it as the following:Function long GetSystemDirectory(ref string lpBuffer , long ByVal ) Library 'kernel32.dll' Alias for 'GetSystemDirectoryA'
Delete Directory
If you want to dynamically remove a directory in a computer program, you can use the 'RemoveDirectory' function. The function has to be declared as the following before you can use it:Function long RemoveDirectory(string lpPathName) Library 'kernel32.dll' Alias for 'RemoveDirectoryA'
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment