J/Direct Call Builder

Using the J/Direct Call Builder, you can quickly create J/Direct calls to the Win32 API. The J/Direct Call Builder automatically inserts Java definitions for the Win32 API elements into your code, along with the appropriate @dll.import tags.

To access the Win32 API with the J/Direct Call Builder

  1. To open the J/Direct Call Builder, point to Other Windows on the View menu and click J/Direct Call Builder.

  2. By default, the J/Direct Call Builder displays elements defined in the following Win32 DLLs: advapi32.dll, gdi32.dll, kernel32.dll, shell32.dll, spoolss.dll, user32.dll, and winmm.dll. (These DLLs are specified by the WIN32.TXT file, which is selected under Source.)

  3. The Target box identifies the class to contain the J/Direct calls. By default, a class named Win32 will be added to your project and will contain these calls. (If your solution contains multiple Java projects, the Win32 class is added to the first project.)

    To specify a different target class, click the ellipses button (...).

    • In the Select Class dialog box, select whether you want to view your classes in Project View or Class View. Project view displays a hierarchical list of the .java files in your solution, where each file node lists the names of the classes contained in that file. Class view displays a hierarchical list of class names.

    • Once you have chosen a view, select the name of the class to contain the J/Direct calls. (To copy the calls to the Windows Clipboard instead of to a class, select Clipboard.)

    • Click OK.

  4. To filter the display of Win32 methods, structs, and constants, select or clear the Methods, Structs, and Constants options.

  5. Now select the method, struct, or constant that you want to insert. (You can select multiple items using the SHIFT and CTRL keys.) Note that a Win32 struct will be added as a nested class inside your class.

    Note    To search for an item by its initial characters, type the characters into the Find box. The first item that matches these characters is automatically selected.

  6. To insert the associated Java definition into your class, click Copy To Target. (You can also double-click the method, struct, or constant to insert it into your class.)

When a Win32 API element is selected in the J/Direct Call Builder, the lower preview pane displays the associated Java definition. You can copy and paste this text into any file. To quickly find the online reference information for a Win32 API element, right-click the item and click Display API Help on the shortcut menu.

For information about the default settings for this builder, see Setting J/Direct Call Builder Options.