jawin API翻译

org.jawin
Class FuncPtr
java.lang.Object
  org.jawin.FuncPtr

--------------------------------------------------------------------------------

public final class FuncPtr
extends java.lang.Object
这个是用来调用标准DLL的类
Class for working with a reference to a single Win32 function exposed in standard DLL's. The Jawin Userguide - Calling a DLL Entry Point
这个文档可以当作如何使用JAWIN的参考
document should be consulted about how to use this class.

包括了一些常用的函数的调用方法
Contains several invoke_*-methods for some standard function signatures.
可以大概分成一下三种
These falls in three groups:

invoke_I- 一些以INT做为标准返回的本地方法的调用函数
methods for native methods with a standard int as [retval]
invoke_OI-一些最后参数作为[out]返回的本地方法的调用函数

methods for native methods with a last parameter being a [out] int
invoke_S-一些返回数组的本地方法的调用函数(也可以被使用那些返回为STRUCTS的方法)
methods for native methods returning a byte array (can be used for methods returning structs)
Please notice that because of the TYPEDEF in C/C++ many method signatures are covered by the relatively few invoke_*-methods, as eg. HWND, HRESULT, LONG etc. all can be represented as Java int's.
请注意C/C++的返回信息的类型和JAVA不同,但是有一些类型可以用java的一些类型代替
比图 HWND,HRRSULT LONG等等 这些都能被表示成为java的int
If working with a function that does not match one of the standard signatures, use the generic invoke(String, int, NakedByteStream, Object[], ReturnFlags).
如果使用的一些函数不能和标准的调用方法不匹配,请使用标准的调用方法


Version:
版本 1.3
$Revision: 1.3 $
Author:
作者:
Stuart Halloway, http://www.relevancellc.com/halloway/weblog/
Morten Andersen, arosii_moa (at) users.sourceforge.net
See Also:
例子:
The Jawin Userguide - Calling a DLL Entry Point

--------------------------------------------------------------------------------

Constructor Summary构造器描述
FuncPtr(java.lang.String dll, java.lang.String name)
           
? Method Summary
void close()
          Call to "free" the function pointer. 释放函数指针
boolean equals(java.lang.Object o)
           
protected  void finalize()
          backup for releasing resources, by calling close().备份被释放的资源
int getPeer()
           
int hashCode()
           
int invoke_I(byte[] arg0, ReturnFlags flags)
调用需要一个数组指针作为参数的本地方法,返回整形变量
          for calling native methods taking one pointer to a byte array, and returning an int. 
int invoke_I(int arg0, int arg1, int arg2, int arg3, ReturnFlags flags)
返回需要四个整形变量作为参数的本 地方法,返回一个整形变量
          for calling native methods taking four int args, and returning an int.
int invoke_I(int arg0, int arg1, ReturnFlags flags)
调用以两个整形变量作为参数的本地方法,返回一个整形变量
          for calling native methods taking two int args, and returning an int.
int invoke_I(int arg0, ReturnFlags flags)
调用以一个整形变量作为参数的本地方法,返回一个整形变量
          for calling native methods taking one int arg, and returning an int.
int invoke_I(int arg0, java.lang.String arg1, ReturnFlags flags)
调用以一个整形变量和以个字符串变量为参数的本地方法,返回一个整形变量
          for calling native methods taking one int and one String args, and returning an int.
int invoke_I(int arg0, java.lang.String arg1, java.lang.String arg2, int arg3, ReturnFlags flags)

调用以一个整形变量和两个字符串变量和一个整形变量作为参数的本地方法,返回一个整形变量(使用MessageBoxWDEMO的例子)
          for calling native methods taking one int, two String and one int args, and returning an int (used for MessageBoxW).

int invoke_I(ReturnFlags flags)
调用没有变量的本地方法,返回一个整形变量
          for calling native methods taking no args, and returning an int.
int invoke_I(java.lang.String arg0, ReturnFlags flags)
调用以一个字符串作为参数的本地方法,返回一个整形变量
          for calling native methods taking one String arg, and returning an int.
int invoke_I(java.lang.String arg0, java.lang.String arg1, ReturnFlags flags)
调用以两个字符串变量的本地方法,返回一个整形变量
          for calling native methods taking two String args, and returning an int.
int invoke_OI(int arg0, int arg1, int arg2, int arg3, ReturnFlags flags)
调用以五个整形变量,其中前面四个作为[IN]参数,最后一个作为[OUT]变量的本地方法
          for calling native methods taking five int args, where the first four are standard [in] parameters and the last int is a [out] parameter.
int invoke_OI(int arg0, ReturnFlags flags)
调用以两个整形变量,其中最后个整形变量作为[OUT]变量 作为参数的本地方法,
          for calling native methods taking two int args, where the last int is a [out] parameter. 
int invoke_OI(int arg0, java.lang.String arg1, ReturnFlags flags)
调用以一个整形变量作为[IN]参数,一个字符串类型作为[OUT]参数的本地方法,返回一个整形
          for calling native methods taking one [in] int, one [in] String and one [out] int arg.
byte[] invoke_S(byte[] arg0, int arg1, int returnSize, ReturnFlags flags)
调用以一个数组指针一个整形变量作为参数的本地方法,返回一个制定大小的BYTE数组
          for calling native methods taking one pointer to a byte array and one int args, and returning a byte array of a specified size.
byte[] invoke_S(byte[] arg0, int returnSize, ReturnFlags flags)
调用以一个数组指针作为参数的本地方法,返回一个指定大小的byte数组
          for calling native methods taking one pointer to a byte array, and returning a byte array of a specified size.
byte[] invoke_S(int arg0, int returnSize, ReturnFlags flags)
调用以一个整形变量作为参数的本地方法,返回一个指定大小的BYTE数组(一般用于返回以个已知大小的STRUCT的情况)
          for calling native methods taking one int arg, and returning a byte array of a specified size (typically used when calling methods returning a struct with a known byte-size).
byte[] invoke(java.lang.String instructions, int stackSize, int argStreamSize, byte[] argStream, java.lang.Object[] objectArgs, ReturnFlags flags)
调用那些不匹配invoke_*调用方法的本地方法
          generic method for calling native methods that do not match any of the invoke_* methods. 
byte[] invoke(java.lang.String instructions, int stackSize, NakedByteStream argStream, java.lang.Object[] objectArgs, ReturnFlags flags)
一种调用使用了NakedByteStream构造输入参数流的invoke(String, int, int, byte[], Object[], ReturnFlags) 的快捷方法
          shortcut method for calling invoke(String, int, int, byte[], Object[], ReturnFlags) when using a NakedByteStream for building the argStream-bytes.
java.lang.String toString()


Methods inherited from class java.lang.Object这些方法继承了ava.lang.Object
clone, getClass, notify, notifyAll, wait, wait, wait
?

Constructor Detail


FuncPtr
public FuncPtr(java.lang.String dll,
              java.lang.String name)
        throws COMExceptionParameters:
参数:
dll - DLL动态库的名称(可以是只有名字的DLL动态库或者是完全地址的名字DLL动态库,注释,文件的后缀不是一定需要的准确的参数语法可以再MSDN文档库里找到
the name of a DLL (can be either just the name of the DLL or a full path - use backslashes (/)). Note, that the name is not case sensitive and that the ".dll"-part is optional. The exact syntax for the parameter can be found in the MSDN documentation for LoadLibrary.
name - DLL动态库中可被见的本地方法
the function name exposed in the DLL.
Throws:
COMException - 当不能连接到DLL动态库或者找不到方法会发出错误
if unable to load the DLL or find the function.
java.lang.NullPointerException - 当DLL动态库的名字是空会发出的错误
if either dll or name is null.
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值