Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed compile errors #620

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions contrib/monitordemo/.classpath
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry combineaccessrules="false" kind="src" path="/jnalib"/>
<classpathentry combineaccessrules="false" kind="src" path="/platform"/>
<classpathentry kind="output" path="build/classes"/>
</classpath>
17 changes: 17 additions & 0 deletions contrib/monitordemo/.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>monitordemo</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
68 changes: 68 additions & 0 deletions contrib/monitordemo/build.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
<?xml version="1.0" encoding="UTF-8"?>
<project name="jnacontrib.monitordemo" default="jar" basedir=".">
<description>Builds, tests, and runs the project jnacontrib.monitordemo.</description>
<!-- Locations -->
<property name="src" location="./src"/>
<property name="build" location="build"/>
<property name="jna-dist" location="../../dist"/>

<property name="classes" location="${build}/classes"/>
<property name="jar" location="${build}/demo-monitordemo.jar"/>
<property name="file.reference.jna.jar" location="../../build/jna.jar"/>
<property name="main-class" value="com.sun.jna.contrib.demo.MonitorInfoDemo.java" />

<path id="classpath">
<fileset file="${file.reference.jna.jar}"/>
<fileset dir="../platform/dist" includes="jna-platform.jar"/>
</path>

<!-- Run Demo. -->
<target name="run" depends="compile">
<java classname="${main-class}" fork="true">
<classpath>
<pathelement location="${classes}" />
<path refid="classpath"/>
</classpath>
</java>
</target>

<!-- Delete class and jar files. -->
<target name="clean">
<delete dir="${classes}"/>
<delete file="${jar}"/>
<delete dir="${build}"/>
</target>

<!-- Compile all classes. -->
<target name="compile">
<mkdir dir="${classes}"/>
<!-- Compile the project. -->
<javac srcdir="${src}" destdir="${classes}" target="1.5" source="1.5"
encoding="UTF-8" debug="on" includeantruntime="false">
<classpath>
<path refid="classpath"/>
</classpath>
</javac>
</target>

<!-- Create jar-file. -->
<target name="jar" depends="compile">

<!-- Copy all non-java files to classes. -->
<copy todir="${classes}/com">
<fileset dir="${src}/com">
<exclude name="**/*.java"/>
</fileset>
</copy>

<jar jarfile="${jar}" basedir="${classes}">
<manifest>
<attribute name="Main-Class" value="${main-class}"/>
</manifest>
<!-- platform -->
<fileset dir="../platform/build/classes"/>
<!-- jna -->
<zipfileset src="${file.reference.jna.jar}"/>
</jar>
</target>
</project>
4 changes: 2 additions & 2 deletions contrib/msoffice/.classpath
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
<classpathentry combineaccessrules="false" kind="src" path="/com.sun.jna"/>
<classpathentry combineaccessrules="false" kind="src" path="/com.sun.jna.platform"/>
<classpathentry combineaccessrules="false" kind="src" path="/jnalib"/>
<classpathentry combineaccessrules="false" kind="src" path="/platform"/>
<classpathentry kind="output" path="bin"/>
</classpath>
68 changes: 68 additions & 0 deletions contrib/msoffice/build.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
<?xml version="1.0" encoding="UTF-8"?>
<project name="jnacontrib.msoffice" default="jar" basedir=".">
<description>Builds, tests, and runs the project jnacontrib.msoffice.</description>
<!-- Locations -->
<property name="src" location="./src"/>
<property name="build" location="build"/>
<property name="jna-dist" location="../../dist"/>

<property name="classes" location="${build}/classes"/>
<property name="jar" location="${build}/demo-msoffice.jar"/>
<property name="file.reference.jna.jar" location="../../build/jna.jar"/>
<property name="main-class" value="" />

<path id="classpath">
<fileset file="${file.reference.jna.jar}"/>
<fileset dir="../platform/dist" includes="jna-platform.jar"/>
</path>

<!-- Run Demo. -->
<target name="run" depends="compile">
<java classname="${main-class}" fork="true">
<classpath>
<pathelement location="${classes}" />
<path refid="classpath"/>
</classpath>
</java>
</target>

<!-- Delete class and jar files. -->
<target name="clean">
<delete dir="${classes}"/>
<delete file="${jar}"/>
<delete dir="${build}"/>
</target>

<!-- Compile all classes. -->
<target name="compile">
<mkdir dir="${classes}"/>
<!-- Compile the project. -->
<javac srcdir="${src}" destdir="${classes}" target="1.5" source="1.5"
encoding="UTF-8" debug="on" includeantruntime="false">
<classpath>
<path refid="classpath"/>
</classpath>
</javac>
</target>

<!-- Create jar-file. -->
<target name="jar" depends="compile">

<!-- Copy all non-java files to classes. -->
<copy todir="${classes}/com">
<fileset dir="${src}/com">
<exclude name="**/*.java"/>
</fileset>
</copy>

<jar jarfile="${jar}" basedir="${classes}">
<manifest>
<attribute name="Main-Class" value="${main-class}"/>
</manifest>
<!-- platform -->
<fileset dir="../platform/build/classes"/>
<!-- jna -->
<zipfileset src="${file.reference.jna.jar}"/>
</jar>
</target>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@

import java.io.File;

import com.sun.jna.Pointer;
import com.sun.jna.platform.win32.Ole32;
import com.sun.jna.platform.win32.COM.COMException;
import com.sun.jna.platform.win32.COM.util.Factory;
import com.sun.jna.platform.win32.COM.util.office.word.ComIApplication;
Expand All @@ -40,6 +42,7 @@ public void testMSWord() {
ComWord_Application msWordObject = null;
ComIApplication msWord = null;
Factory factory = null;
Ole32.INSTANCE.CoInitializeEx(Pointer.NULL, Ole32.COINIT_MULTITHREADED);
try {
String tempDir = System.getProperty("java.io.tmpdir");
System.out.println("Files in temp dir: "+tempDir);
Expand Down Expand Up @@ -101,9 +104,7 @@ public void testMSWord() {
if (msWord != null) {
msWord.Quit();
}
if (null != factory) {
factory.getComThread().terminate(500);
}
}
Ole32.INSTANCE.CoUninitialize();
}
}
2 changes: 1 addition & 1 deletion contrib/native_window_msg/.classpath
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry combineaccessrules="false" kind="src" path="/jnalib"/>
<classpathentry kind="lib" path="C:/GitHub/jna-3.5.1.jar"/>
<classpathentry combineaccessrules="false" kind="src" path="/platform"/>
<classpathentry kind="output" path="bin"/>
</classpath>
68 changes: 68 additions & 0 deletions contrib/native_window_msg/build.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
<?xml version="1.0" encoding="UTF-8"?>
<project name="jnacontrib.native_window_msg" default="jar" basedir=".">
<description>Builds, tests, and runs the project jnacontrib.native_window_msg.</description>
<!-- Locations -->
<property name="src" location="./src"/>
<property name="build" location="build"/>
<property name="jna-dist" location="../../dist"/>

<property name="classes" location="${build}/classes"/>
<property name="jar" location="${build}/demo-nativewindowmsg.jar"/>
<property name="file.reference.jna.jar" location="../../build/jna.jar"/>
<property name="main-class" value="com.sun.jna.platform.win32.Win32WindowDemo.java" />

<path id="classpath">
<fileset file="${file.reference.jna.jar}"/>
<fileset dir="../platform/dist" includes="jna-platform.jar"/>
</path>

<!-- Run Demo. -->
<target name="run" depends="compile">
<java classname="${main-class}" fork="true">
<classpath>
<pathelement location="${classes}" />
<path refid="classpath"/>
</classpath>
</java>
</target>

<!-- Delete class and jar files. -->
<target name="clean">
<delete dir="${classes}"/>
<delete file="${jar}"/>
<delete dir="${build}"/>
</target>

<!-- Compile all classes. -->
<target name="compile">
<mkdir dir="${classes}"/>
<!-- Compile the project. -->
<javac srcdir="${src}" destdir="${classes}" target="1.5" source="1.5"
encoding="UTF-8" debug="on" includeantruntime="false">
<classpath>
<path refid="classpath"/>
</classpath>
</javac>
</target>

<!-- Create jar-file. -->
<target name="jar" depends="compile">

<!-- Copy all non-java files to classes. -->
<copy todir="${classes}/com">
<fileset dir="${src}/com">
<exclude name="**/*.java"/>
</fileset>
</copy>

<jar jarfile="${jar}" basedir="${classes}">
<manifest>
<attribute name="Main-Class" value="${main-class}"/>
</manifest>
<!-- platform -->
<fileset dir="../platform/build/classes"/>
<!-- jna -->
<zipfileset src="${file.reference.jna.jar}"/>
</jar>
</target>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -13,27 +13,21 @@

package com.sun.jna.platform.win32;

import com.sun.jna.WString;
import com.sun.jna.platform.win32.DBT;
import com.sun.jna.platform.win32.DBT.DEV_BROADCAST_DEVICEINTERFACE;
import com.sun.jna.platform.win32.DBT.DEV_BROADCAST_HANDLE;
import com.sun.jna.platform.win32.DBT.DEV_BROADCAST_HDR;
import com.sun.jna.platform.win32.DBT.DEV_BROADCAST_OEM;
import com.sun.jna.platform.win32.DBT.DEV_BROADCAST_PORT;
import com.sun.jna.platform.win32.DBT.DEV_BROADCAST_VOLUME;
import com.sun.jna.platform.win32.Kernel32;
import com.sun.jna.platform.win32.User32;
import com.sun.jna.platform.win32.WinDef.HMODULE;
import com.sun.jna.platform.win32.WinDef.HWND;
import com.sun.jna.platform.win32.WinDef.LPARAM;
import com.sun.jna.platform.win32.WinDef.LRESULT;
import com.sun.jna.platform.win32.WinDef.WPARAM;
import com.sun.jna.platform.win32.WinUser;
import com.sun.jna.platform.win32.WinUser.HDEVNOTIFY;
import com.sun.jna.platform.win32.WinUser.MSG;
import com.sun.jna.platform.win32.WinUser.WNDCLASSEX;
import com.sun.jna.platform.win32.WinUser.WindowProc;
import com.sun.jna.platform.win32.Wtsapi32;

// TODO: Auto-generated Javadoc
/**
Expand All @@ -46,7 +40,7 @@ public class Win32WindowDemo implements WindowProc {
*/
public Win32WindowDemo() {
// define new window class
WString windowClass = new WString("MyWindowClass");
String windowClass = new String("MyWindowClass");
HMODULE hInst = Kernel32.INSTANCE.GetModuleHandle("");

WNDCLASSEX wClass = new WNDCLASSEX();
Expand Down
14 changes: 8 additions & 6 deletions contrib/w32printing/.classpath
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
<classpathentry kind="output" path="bin"/>
</classpath>
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
<classpathentry combineaccessrules="false" kind="src" path="/platform"/>
<classpathentry combineaccessrules="false" kind="src" path="/jnalib"/>
<classpathentry kind="output" path="bin"/>
</classpath>
58 changes: 58 additions & 0 deletions contrib/w32printing/build.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<?xml version="1.0" encoding="UTF-8"?>
<project name="jnacontrib.w32printing" default="jar" basedir=".">
<description>Builds, tests, and runs the project jnacontrib.w32printing.</description>
<!-- Locations -->
<property name="src" location="./src"/>
<property name="build" location="build"/>
<property name="jna-dist" location="../../dist"/>

<property name="classes" location="${build}/classes"/>
<property name="jar" location="${build}/demo-w32printing.jar"/>
<property name="file.reference.jna.jar" location="../../build/jna.jar"/>
<property name="main-class" value="com.sun.jna.platform.win32.Win32SpoolMonitor.java" />

<path id="classpath">
<fileset file="${file.reference.jna.jar}"/>
<fileset dir="../platform/dist" includes="jna-platform.jar"/>
</path>

<!-- Delete class and jar files. -->
<target name="clean">
<delete dir="${classes}"/>
<delete file="${jar}"/>
<delete dir="${build}"/>
</target>

<!-- Compile all classes. -->
<target name="compile">
<mkdir dir="${classes}"/>
<!-- Compile the project. -->
<javac srcdir="${src}" destdir="${classes}" target="1.5" source="1.5"
encoding="UTF-8" debug="on" includeantruntime="false">
<classpath>
<path refid="classpath"/>
</classpath>
</javac>
</target>

<!-- Create jar-file. -->
<target name="jar" depends="compile">

<!-- Copy all non-java files to classes. -->
<copy todir="${classes}/com">
<fileset dir="${src}/com">
<exclude name="**/*.java"/>
</fileset>
</copy>

<jar jarfile="${jar}" basedir="${classes}">
<manifest>
<attribute name="Main-Class" value="${main-class}"/>
</manifest>
<!-- platform -->
<fileset dir="../platform/build/classes"/>
<!-- jna -->
<zipfileset src="${file.reference.jna.jar}"/>
</jar>
</target>
</project>