-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 68d7e94
Showing
81 changed files
with
2,744 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Eclipse workspace metadata | ||
/.metadata | ||
|
||
External Plug-in Libraries/ | ||
|
||
# Eclipse compiler output | ||
bin/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<classpath> | ||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/> | ||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> | ||
<classpathentry kind="src" path="src"/> | ||
<classpathentry kind="output" path="bin"/> | ||
</classpath> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<projectDescription> | ||
<name>com.sun.jna.examples.win32</name> | ||
<comment></comment> | ||
<projects> | ||
</projects> | ||
<buildSpec> | ||
<buildCommand> | ||
<name>org.eclipse.jdt.core.javabuilder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
<buildCommand> | ||
<name>org.eclipse.pde.ManifestBuilder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
<buildCommand> | ||
<name>org.eclipse.pde.SchemaBuilder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
</buildSpec> | ||
<natures> | ||
<nature>org.eclipse.pde.PluginNature</nature> | ||
<nature>org.eclipse.jdt.core.javanature</nature> | ||
</natures> | ||
</projectDescription> |
72 changes: 72 additions & 0 deletions
72
com.sun.jna.examples.win32/.settings/org.eclipse.jdt.core.prefs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
#Tue Feb 09 12:19:26 CET 2010 | ||
eclipse.preferences.version=1 | ||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled | ||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 | ||
org.eclipse.jdt.core.compiler.compliance=1.5 | ||
org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning | ||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error | ||
org.eclipse.jdt.core.compiler.problem.autoboxing=ignore | ||
org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning | ||
org.eclipse.jdt.core.compiler.problem.deadCode=warning | ||
org.eclipse.jdt.core.compiler.problem.deprecation=warning | ||
org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled | ||
org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled | ||
org.eclipse.jdt.core.compiler.problem.discouragedReference=warning | ||
org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore | ||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error | ||
org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore | ||
org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled | ||
org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore | ||
org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning | ||
org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning | ||
org.eclipse.jdt.core.compiler.problem.forbiddenReference=error | ||
org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning | ||
org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning | ||
org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore | ||
org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore | ||
org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore | ||
org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning | ||
org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore | ||
org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore | ||
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore | ||
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled | ||
org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning | ||
org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore | ||
org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning | ||
org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning | ||
org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore | ||
org.eclipse.jdt.core.compiler.problem.nullReference=warning | ||
org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning | ||
org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore | ||
org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore | ||
org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore | ||
org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning | ||
org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore | ||
org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore | ||
org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled | ||
org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning | ||
org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled | ||
org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore | ||
org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning | ||
org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning | ||
org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore | ||
org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning | ||
org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore | ||
org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore | ||
org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore | ||
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore | ||
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled | ||
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled | ||
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled | ||
org.eclipse.jdt.core.compiler.problem.unusedImport=warning | ||
org.eclipse.jdt.core.compiler.problem.unusedLabel=warning | ||
org.eclipse.jdt.core.compiler.problem.unusedLocal=warning | ||
org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore | ||
org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore | ||
org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled | ||
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled | ||
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled | ||
org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning | ||
org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning | ||
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning | ||
org.eclipse.jdt.core.compiler.source=1.5 |
31 changes: 31 additions & 0 deletions
31
com.sun.jna.examples.win32/.settings/org.eclipse.pde.prefs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#Tue Feb 09 12:19:26 CET 2010 | ||
compilers.f.unresolved-features=1 | ||
compilers.f.unresolved-plugins=1 | ||
compilers.incompatible-environment=1 | ||
compilers.p.build=1 | ||
compilers.p.build.bin.includes=1 | ||
compilers.p.build.java.compliance=1 | ||
compilers.p.build.missing.output=2 | ||
compilers.p.build.output.library=1 | ||
compilers.p.build.source.library=1 | ||
compilers.p.build.src.includes=1 | ||
compilers.p.deprecated=1 | ||
compilers.p.discouraged-class=1 | ||
compilers.p.internal=1 | ||
compilers.p.missing-packages=2 | ||
compilers.p.missing-version-export-package=2 | ||
compilers.p.missing-version-import-package=2 | ||
compilers.p.missing-version-require-bundle=2 | ||
compilers.p.no-required-att=0 | ||
compilers.p.not-externalized-att=2 | ||
compilers.p.unknown-attribute=1 | ||
compilers.p.unknown-class=1 | ||
compilers.p.unknown-element=1 | ||
compilers.p.unknown-identifier=1 | ||
compilers.p.unknown-resource=1 | ||
compilers.p.unresolved-ex-points=0 | ||
compilers.p.unresolved-import=0 | ||
compilers.s.create-docs=false | ||
compilers.s.doc-folder=doc | ||
compilers.s.open-tags=1 | ||
eclipse.preferences.version=1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
Manifest-Version: 1.0 | ||
Bundle-ManifestVersion: 2 | ||
Bundle-Name: Win32 Example implementations | ||
Bundle-SymbolicName: com.sun.jna.examples.win32 | ||
Bundle-Version: 1.0.0.qualifier | ||
Bundle-Vendor: SUN | ||
Bundle-RequiredExecutionEnvironment: J2SE-1.5 | ||
Export-Package: com.sun.jna.examples.win32;version="1.0.0" | ||
Import-Package: com.sun.jna, | ||
com.sun.jna.ptr, | ||
com.sun.jna.win32 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
source.. = src/ | ||
bin.includes = .classpath,\ | ||
.project,\ | ||
.settings/,\ | ||
build.properties,\ | ||
META-INF/,\ | ||
. |
37 changes: 37 additions & 0 deletions
37
com.sun.jna.examples.win32/src/com/sun/jna/examples/win32/ComCtl32.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package com.sun.jna.examples.win32; | ||
|
||
import com.sun.jna.Native; | ||
import com.sun.jna.Structure; | ||
|
||
/** | ||
* Incomplete interface to the Common Controls Library (comctl32.dll) | ||
* | ||
* @author <a href="mailto:phil.kursawe@gmail.com">Philipp Kursawe</a> | ||
* | ||
*/ | ||
public interface ComCtl32 extends W32API { | ||
ComCtl32 INSTANCE = (ComCtl32) Native.loadLibrary("comctl32", | ||
ComCtl32.class, DEFAULT_OPTIONS); | ||
|
||
class TCITEM extends Structure { | ||
public int mask; | ||
public int dwState; | ||
public int dwStateMask; | ||
public int pszText; | ||
public int cchTextMax; | ||
public int iImage; | ||
public LPARAM lParam; | ||
} | ||
|
||
int TCIF_TEXT = 0x0001; | ||
int TCIF_IMAGE = 0x0002; | ||
int TCIF_PARAM = 0x0008; | ||
int TCIF_STATE = 0x0010; | ||
int TCM_GETITEMA = ComCtl32.TCM_FIRST + 5; | ||
int TCM_GETITEMW = ComCtl32.TCM_FIRST + 60; | ||
int TCM_GETITEM = UNICODE_OPTIONS.equals(DEFAULT_OPTIONS) ? TCM_GETITEMW | ||
: TCM_GETITEMA; | ||
int TCM_FIRST = 0x1300; | ||
int TCM_GETITEMCOUNT = TCM_FIRST + 4; | ||
|
||
} |
141 changes: 141 additions & 0 deletions
141
com.sun.jna.examples.win32/src/com/sun/jna/examples/win32/GDI32.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,141 @@ | ||
/* Copyright (c) 2007 Timothy Wall, All Rights Reserved | ||
* | ||
* This library is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU Lesser General Public | ||
* License as published by the Free Software Foundation; either | ||
* version 2.1 of the License, or (at your option) any later version. | ||
* <p/> | ||
* This library 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 | ||
* Lesser General Public License for more details. | ||
*/ | ||
package com.sun.jna.examples.win32; | ||
|
||
import java.awt.Rectangle; | ||
|
||
import com.sun.jna.Native; | ||
import com.sun.jna.Pointer; | ||
import com.sun.jna.Structure; | ||
import com.sun.jna.examples.win32.User32.POINT; | ||
import com.sun.jna.ptr.PointerByReference; | ||
|
||
/** Definition (incomplete) of <code>gdi32.dll</code>. */ | ||
public interface GDI32 extends W32API { | ||
|
||
GDI32 INSTANCE = (GDI32) | ||
Native.loadLibrary("gdi32", GDI32.class, DEFAULT_OPTIONS); | ||
|
||
class RECT extends Structure { | ||
public int left; | ||
public int top; | ||
public int right; | ||
public int bottom; | ||
public Rectangle toRectangle() { | ||
return new Rectangle(left, top, right-left, bottom-top); | ||
} | ||
public String toString() { | ||
return "[(" + left + "," + top + ")(" + right + "," + bottom + ")]"; | ||
} | ||
} | ||
|
||
int RDH_RECTANGLES = 1; | ||
class RGNDATAHEADER extends Structure { | ||
public int dwSize = size(); | ||
public int iType = RDH_RECTANGLES; // required | ||
public int nCount; | ||
public int nRgnSize; | ||
public RECT rcBound; | ||
} | ||
class RGNDATA extends Structure { | ||
public RGNDATAHEADER rdh; | ||
public byte[] Buffer; | ||
public RGNDATA(int bufferSize) { | ||
Buffer = new byte[bufferSize]; | ||
allocateMemory(); | ||
} | ||
} | ||
|
||
public HRGN ExtCreateRegion(Pointer lpXform, int nCount, RGNDATA lpRgnData); | ||
|
||
int RGN_AND = 1; | ||
int RGN_OR = 2; | ||
int RGN_XOR = 3; | ||
int RGN_DIFF = 4; | ||
int RGN_COPY = 5; | ||
|
||
int ERROR = 0; | ||
int NULLREGION = 1; | ||
int SIMPLEREGION = 2; | ||
int COMPLEXREGION = 3; | ||
int CombineRgn(HRGN hrgnDest, HRGN hrgnSrc1, HRGN hrgnSrc2, int fnCombineMode); | ||
|
||
HRGN CreateRectRgn(int nLeftRect, int nTopRect, | ||
int nRightRect, int nBottomRect); | ||
|
||
HRGN CreateRoundRectRgn(int nLeftRect, int nTopRect, | ||
int nRightRect, int nBottomRect, | ||
int nWidthEllipse, | ||
int nHeightEllipse); | ||
int ALTERNATE = 1; | ||
int WINDING = 2; | ||
HRGN CreatePolyPolygonRgn(POINT[] lppt, int[] lpPolyCounts, int nCount, int fnPolyFillMode); | ||
|
||
boolean SetRectRgn(HRGN hrgn, int nLeftRect, int nTopRect, int nRightRect, int nBottomRect); | ||
|
||
int SetPixel(HDC hDC, int x, int y, int crColor); | ||
|
||
HDC CreateCompatibleDC(HDC hDC); | ||
boolean DeleteDC(HDC hDC); | ||
|
||
int BI_RGB = 0; | ||
int BI_RLE8 = 1; | ||
int BI_RLE4 = 2; | ||
int BI_BITFIELDS = 3; | ||
int BI_JPEG = 4; | ||
int BI_PNG = 5; | ||
class BITMAPINFOHEADER extends Structure { | ||
public int biSize = size(); | ||
public int biWidth; | ||
public int biHeight; | ||
public short biPlanes; | ||
public short biBitCount; | ||
public int biCompression; | ||
public int biSizeImage; | ||
public int biXPelsPerMeter; | ||
public int biYPelsPerMeter; | ||
public int biClrUsed; | ||
public int biClrImportant; | ||
} | ||
class RGBQUAD extends Structure { | ||
public byte rgbBlue; | ||
public byte rgbGreen; | ||
public byte rgbRed; | ||
public byte rgbReserved = 0; | ||
} | ||
class BITMAPINFO extends Structure { | ||
public BITMAPINFOHEADER bmiHeader = new BITMAPINFOHEADER(); | ||
//RGBQUAD: | ||
//byte rgbBlue; | ||
//byte rgbGreen; | ||
//byte rgbRed; | ||
//byte rgbReserved = 0; | ||
int[] bmiColors = new int[1]; | ||
public BITMAPINFO() { this(1); } | ||
public BITMAPINFO(int size) { | ||
bmiColors = new int[size]; | ||
allocateMemory(); | ||
} | ||
} | ||
int DIB_RGB_COLORS = 0; | ||
int DIB_PAL_COLORS = 1; | ||
HBITMAP CreateDIBitmap(HDC hDC, BITMAPINFOHEADER lpbmih, int fdwInit, | ||
Pointer lpbInit, BITMAPINFO lpbmi, int fuUsage); | ||
HBITMAP CreateDIBSection(HDC hDC, BITMAPINFO pbmi, int iUsage, | ||
PointerByReference ppvBits, Pointer hSection, | ||
int dwOffset); | ||
HBITMAP CreateCompatibleBitmap(HDC hDC, int width, int height); | ||
|
||
HANDLE SelectObject(HDC hDC, HANDLE hGDIObj); | ||
boolean DeleteObject(HANDLE p); | ||
} |
Oops, something went wrong.