How can i get the Handle (HWND) of a java.awt.Canvas on Windows NT/98?

Davanum Srinivas

import java.awt.*;
import sun.awt.*;

/* This class uses undocumented features of Sun's JDK  */
/* Works only on Windows NT/98 with JDK1.1.8, JDK1.2.2 */
public class SunCanvas extends Canvas
    /* Returns the HWND for canvas. */
    public int getHWND() 
        DrawingSurfaceInfo drawingSurfaceInfo;
        Win32DrawingSurface win32DrawingSurface;
        int hwnd = 0;
        /* Get the drawing surface */   
        drawingSurfaceInfo =
        if (null != drawingSurfaceInfo) {
            /* Get the Win32 specific information */
            win32DrawingSurface = 
            hwnd = win32DrawingSurface.getHWnd();
        return hwnd;
0 Comments  (click to add your comment)
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



About | Sitemap | Contact
We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.