This requires the "ShellExecute" API which resides in shell32.dll. This simulates the act of double-clicking on a file. Process a file with registered application note that lv_UserName must be pre-initialised with spacesĪctivate "winapi".getusername(lv_UserName, lv_BufLen)Ĩ. This requires the "GetUserName" API which resides in advapi32.dll.
HTMLHELP WIN API VBA WINDOWS
This retrieves the username from the Windows logon. note that lv_string must be pre-initialised with spacesĪctivate "winapi".getinistring(lv_Section %\ GETINISTRING (string section, string keyname, string default, string returnstring, numeric size) This requires the "GetIniString" API which resides in kernel32.dll. This will retrieve a string from a Windows INI file. (lv_fullpath now contains "F:\UNIFACE\7206\sample\test.html") note that lv_FullPath must be pre-initialised with spacesĪctivate "winapi".getfullpathname(lv_filename, 128, lv_FullPath, 0) GETFULLPATHNAME (string filename, numeric buflen, string buffer, numeric filepart) This requires the "GetFullPathName" API which resides in kernel32.dll.
HTMLHELP WIN API VBA FULL
This converts a relative path name into a full path name. (lv_directory now contains "F:\UNIFACE\7206\sample") note that lv_directory must be pre-initialised with spacesĪctivate "winapi".getcurrentdirectory(128, lv_directory) GETCURRENTDIRECTORY (numeric buflen, string path) This requires the "GetCurrentDirectory" API which resides in kernel32.dll. This obtains the name of the current working directory. (lv_Program now contains "C:\PROGRA~1\INTERN~1\iexplore.exe") note that lv_Program must be pre-initialised with spacesĪctivate "winapi".findexecutable(lv_file,lv_directory,lv_Program) The calling sequence is as follows:-įINDEXECUTABLE (string file, string defaultdirectory, string result) This requires the "FindExecutable" API which resides in shell32.dll. This obtains from the system registry the name of the application which is associated with a particular file extension. Find program associated with a file extension The calling sequence is as follows:-Īctivate "winapi".deletefile(lv_filename)ģ. This requires the "DeleteFile" API which resides in kernel32.dll. The calling sequence is as follows:-ĬOPYFILE (string from, string to, boolean failifexists)Īctivate "winapi".copyfile(lv_fromfile,lv_tofile,lv_failifexists) This requires the "CopyFile" API which resides in kernel32.dll.
HTMLHELP WIN API VBA UPDATE
Note that you also have to update the section in your usys.ini file in order to point to the Windows DLL file that contains each API. This contains a single component called "winapi" which has a separate operation for each API. This article describes some of the Windows API's that I have used, and their signatures are available in an export file which can be downloaded from here.