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

📄 jawt_info.~pas

📁 一个可用delphi来开发java的JNI开发包delphi接口
💻 ~PAS
字号:
unit jawt_info;

interface
uses jawt_delphi,jawt_md,jni,SysUtils;
type

    TJAWT_Info=class
      private
         awt:JAWT;
         ds:PJAWT_DrawingSurface;
         dsi:PJAWT_DrawingSurfaceInfo;
         dsi_win:PJAWT_Win32DrawingSurfaceInfo;
      public
        constructor create( env:pJNIEnv;canvas:jobject);
        destructor destroy();
        function getHWND:integer;
        function getHDC:integer;
    end;

implementation

{ TJAWT_Info }

constructor TJAWT_Info.create(env: pJNIEnv; canvas: jobject);
var  result1:jboolean;
     lock1:jint;
begin
        // Get the AWT
     //    writeln('');
    //     writeln('');
        awt.version := JAWT_VERSION_1_3;
        result1 := JAWT_GetAWT(env, @awt);
    //    writeln('JAWT_GetAWT'+inttostr(integer(result1)));
        assert(result1<>JNI_FALSE);
        // Get the drawing surface
   //     writeln('调用JAWT_GetAWT成功');
        ds := awt.GetDrawingSurface(env, canvas);
   //     writeln('测试GetDrawingSurface');

        if(ds = Nil) then exit;
    //    writeln('GetDrawingSurface成功');

        // Lock the drawing surface
        lock1 := ds.Lock(ds);
        assert((lock1 and JAWT_LOCK_ERROR) = 0);
        // Get the drawing surface info
        dsi := ds.GetDrawingSurfaceInfo(ds);
   //     writeln('测试GetDrawingSurfaceInfo');
        // Get the platform-specific drawing info
        dsi_win :=PJAWT_Win32DrawingSurfaceInfo(dsi.platformInfo);
        if dsi_win=nil then exit;
   //     writeln('测试GetDrawingSurfaceInfo成功');
   //     writeln('全部成功');
end;

destructor TJAWT_Info.destroy;
begin
        if(ds <> Nil)then
        begin
            // Free the drawing surface info
            ds.FreeDrawingSurfaceInfo(dsi);
            // Unlock the drawing surface
            ds.Unlock(ds);
            // Free the drawing surface
            awt.FreeDrawingSurface(ds);
        end;
end;

function TJAWT_Info.getHDC: integer;
begin
      result:=0;
      if(dsi_win = NiL)then
            exit;
      result:=dsi_win.hdc;
end;

function TJAWT_Info.getHWND: integer;
begin
      result:=-1;
      if(dsi_win = NiL)then
            exit;
      result:=dsi_win.hwnd;
end;

end.

⌨️ 快捷键说明

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