dlltest.java

来自「java 调用windows的api」· Java 代码 · 共 42 行

JAVA
42
字号
/*
 * DllTest.java -
 *
 * This file is part of the Jawin Project: http://jawinproject.sourceforge.net/
 * 
 * Please consult the LICENSE file in the project root directory,
 * or at the project site before using this software.
 */

/* $Id: DllTest.java,v 1.1 2004/06/14 19:24:55 arosii_moa Exp $ */

package org.jawin;

import java.io.File;

import junit.framework.TestCase;

/**
 * DLL test cases. Loads the DLL named 'testdll.dll' in the directory
 * specified in the 'test.dll.dir' property.
 * 
 * @see the cpp testdll project.
 *
 * @version     $Revision: 1.1 $
 * @author      Stuart Halloway, http://www.relevancellc.com/halloway/weblog/
 */
public class DllTest extends TestCase {

	private String testDllDir = System.getProperty("test.dll.dir");
	private String testDll = testDllDir + File.separator + "testdll";

	public void testLifetime() throws Exception {
		FuncPtr fp = new FuncPtr(testDll, "_fnTestdll@0");
		assertTrue(0 == fp.invoke_I(ReturnFlags.CHECK_NONE));
		assertTrue(1 == fp.invoke_I(ReturnFlags.CHECK_NONE));
		fp.close();
		FuncPtr fp2 = new FuncPtr(testDll, "_fnTestdll@0");
		assertTrue(0 == fp2.invoke_I(ReturnFlags.CHECK_NONE));
		fp2.close();
	}
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?