LoadLibrary HMODULE WINAPI LoadLibrary( _In_ LPCTSTR lpFileName ); Loads the specified module into the address space of the calling process. The specified module may cause other modules to be loaded. 用此函数来加载动态链接库到内存. LoadLibrary按照这样的方式来搜寻文件,先在应用程序所在
对于常规java class打成jar文件后,要获取它的本地路径,可以用如下方法. final File f = new File(TestClass.class.getProtectionDomain().getCodeSource().getLocation().getPath()); System.out.println(f.getAbsolutePath()); 如果是SpringBoot的启动类,它会被SpringBoot的class loader加载,实际启动jar的时候其实启动的是
本地路径的创建 在做下载操作时,我们一般先把文件下载到本地指定的路径下,然后再做其他使用. 为了防止程序出现异常,我们通常需要先判断本地是否存在指定的路径. 以C盘Tmp文件夹为例,我们可以这样做,代码如下: if not DirectoryExists('C:\Tmp') then if not CreateDir('C:\Tmp') then raise Exception.Create('Opps, Create New Dir Failed!'); 清空本地指定文件夹下的文件 以C盘Tm