wndproc.java

来自「java 调用windows的api」· Java 代码 · 共 51 行

JAVA
51
字号
//******************************************************************
// Released under the DevelopMentor OpenSource Software License.
// Please consult the LICENSE file in the project root directory,
// or at http://www.develop.com for details before using this
// software.
//******************************************************************

package org.jawin.donated.win32;

import org.jawin.*;
import org.jawin.marshal.*;
import org.jawin.io.*;
import java.io.*;

public abstract class WNDPROC extends WinFuncPtr {
    /*
     * FUNCTION
     */
    abstract public int call(int hwnd, int msg, int wParam, int lParam)
            throws IOException;

    /*
     * MARSHALLING
     */

    public static final String marshal = "4IIII:I:";
    public static final int token = GenericStub.registerCustomString(marshal);
        
        
    protected byte[] call(byte[] inargs, Object[] inobjs)
            throws IOException
    {
        LittleEndianInputStream leis = new LittleEndianInputStream(
                    new ByteArrayInputStream(inargs));
        int hwnd = leis.readInt();
        int msg = leis.readInt();
        int wParam = leis.readInt();
        int lParam = leis.readInt();

        int ret = call(hwnd, msg, wParam, lParam);

        NakedByteStream nbs = new NakedByteStream();
        LittleEndianOutputStream leos = new LittleEndianOutputStream(nbs);
        leos.writeInt(ret);
        return nbs.getInternalBuffer();
    }
}



⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?