⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 console.java

📁 用于Java 组件和通过Windows COM 对象或Windows DLL 来公开的组件之间的互操作
💻 JAVA
字号:
//******************************************************************
// 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 com.develop.jawin.win32;

import com.develop.jawin.*;
import com.develop.jawin.marshal.*;
import com.develop.io.*;
import com.develop.util.*;
import java.io.*;
import java.util.*;

public class Console {

    static final int mtokenHandlerRoutine = 
                                        GenericStub.registerCustomString("1I:I:");
                
    public static boolean SetConsoleCtrlHandler(HandlerRoutine rt, boolean add) 
                        throws COMException, IOException
        {
        FuncPtr fp = new FuncPtr("KERNEL32.DLL", "SetConsoleCtrlHandler");
        NakedByteStream nbs = new NakedByteStream();
        LittleEndianOutputStream leos = new LittleEndianOutputStream(nbs);
        leos.writeInt(0); //offset of callback in obj array
        leos.writeInt(add ? 1 : 0);
        byte[] res = GenericStub.win32Invoke(fp.getPeer(), 
                                        "T2." + mtokenHandlerRoutine + "I:I:", 
                                        8, 12,
                                        nbs.getInternalBuffer(), 
                                        new Object[] {rt});
        return (StructConverter.bytesIntoInt(res, 0) != 0);
    }
}

⌨️ 快捷键说明

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