DLL Calling with J/Direct

These samples demonstrate how to use the new @dll.import directive that allows quick and easy access to functions exported from DLLs (dynamic-link libraries).

To execute a sample, go to any subdirectory and run the Go.bat batch file. It is recommended you run the Simple sample first. For simplicity, all the samples are written as console-mode Java applications that execute under jview. Therefore, it is best to execute Go.bat from the command line.

Unless otherwise noted, these samples are located in the subdirectories of \Samples\JDirect.

Simple The "Hello World" Microsoft® J/Direct™ application. Ensures that J/Direct is correctly installed.
Strings Demonstrates passing and receiving strings from DLLs.
Structs Demonstrates how to represent a C structure using J/Direct.
SDump Displays layout of any J/Direct structure. Handy for debugging.
FuncPtr1 Shows how to simulate a function pointer using J/Direct.
FuncPtr2 A more complex function pointer example.
Pointers Shows how to emulate pointer operations using J/Direct.
LastErr Shows how to capture error codes from the Microsoft® Windows® API.
AutoMode Shows how to use automatic character-size selection for optimal performance.
OleMode Shows special features designed for calling the OLE APIs.
CdPlayer An audio CD player application using the MCI (Media Control Interface) device interface.
CdPlay2 An audio CD player application using the MCI device interface through the Microsoft® Win32® API classes for J/Direct.
TBarIcon Displays and captures mouse messages from a Taskbar notification icon.
Java Media Player Plays different media (audio and video) for the Windows format.
C to Java Parser This parsing tool converts C function prototypes into Java wrappers for those functions and converts structures and trivial C++ classes into Java classes.
Class Decoder The class file decoder reads Java class files and decodes the bytes into the attributes, structures, and properties that make up the class. This sample is located in \Samples\Wfc\ClassDecoder.
CoCreateInstanceEx The CoCreateInstanceEx (CCIEx) sample uses a Java-implemented COM object through a custom interface to pass a string, array, and the client as a COM object. This sample is located in \Samples\Com\CCIEx.
Cryptography These samples are based on the Cryptography example code available from the MSDN™ Library documentation. They show how to import Win32 API functions that use Windows error codes and map these to Java methods that throw com.ms.dll.Win32Exceptions. These samples are located in \Samples\Windows\Crypto.
Java and Tables This sample shows how to stream out an HTML table based on attributes set by the caller. This sample is located in \Samples\ASP.
NT Service These samples show how to build a Microsoft® Windows NT® Service using only Java, implementing the Service Main and Service Control as Java classes. They also show how to use the Windows NT Event Log with a custom message file. These samples are located in \Samples\Com\NTService.

© 1999 Microsoft Corporation. All rights reserved. Terms of use.