⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 genexplorer.java

📁 SWT开发的Java调用COM的工具集
💻 JAVA
字号:
/*
 * Copyright (c) 2007 Software Wizards Pty Ltd, Victoria, Australia.
 * mailto:enquires@swz.com.au. All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted. See the GNU General Public License
 * for more details.
 *
 * Redistribution of the SWTtoCOM software is not permitted as part of any
 * commercial product. Licensing terms for such distribution may be
 * obtained from the copyright holder.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along
 * with this program; if not, write to the Free Software Foundation, Inc.,
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */
package au.com.swz.swttocom.example.browser;

import au.com.swz.jatlom.ITypeLib;
import au.com.swz.swttocom.generator.DefaultFileCreator;
import au.com.swz.swttocom.generator.ISWTtoCOMFileCreator;
import au.com.swz.swttocom.generator.SWTtoCOMGenerator;
import au.com.swz.swttocom.generator.SWTtoCOMGeneratorOptions;
import au.com.swz.swttocom.generator.SystemOutMonitor;


public class GenExplorer {

	public static void main(String[] args) {
		String libraryFileName = "C:\\WINDOWS\\system32\\shdocvw.dll";
		String baseDir = System.getProperty("user.dir") + "\\src";
		ISWTtoCOMFileCreator fileCreator = new DefaultFileCreator(baseDir);
		SWTtoCOMGeneratorOptions generatorOptions = new SWTtoCOMGeneratorOptions();
		generatorOptions.setBasePackageName("au.com.swz.swttocom.example.browser");
		generatorOptions.setLibrarySubPackageName("shdocvw");
		
		generatorOptions.setTypesFromImportedLibrariesIncluded(false);
		generatorOptions.setJavaComplianceLevel("1.5");
		generatorOptions.setGenerateCompositeAsDelegate(false);
		generatorOptions.setBindCoClassAsAliasToDefaultInterface(true);
		generatorOptions.setGenerateDispIdsAsConstants(false);
		generatorOptions.setGenerateEnumerationsAsConstants(false);
		generatorOptions.setGenerateAutomationObjectFactory(false);
		generatorOptions.setGenerateOptParamAsOverloadedMethods(true);
		
		try {
			ITypeLib typeLib = ITypeLib.loadTypeLib(libraryFileName);
			SWTtoCOMGenerator generator = new SWTtoCOMGenerator(generatorOptions, fileCreator);
			generator.generate(typeLib, new SystemOutMonitor());
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

}

⌨️ 快捷键说明

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