How to get HWND in Windows CE

Does any body how to get windows handle (hwnd) in Personal Java in a Windows CE environment. I am using Jeode on a ARM/SA1110 machine.

I have come across two ways (using sun.awt.* and jawt of jdk 1.3) of doing this in a Win32 (NT, 2000) environment but none of them work under Windows CE.

Thanks.

[322 byte] By [nk_agrawal] at [2007-9-26 14:47:50]
# 1

Try the below...I can't guarantee this will work...as getPeer() seems to be deprecated past jdk 1.1, but this works for me with Jeode.

-Brad

import java.awt.Frame;

import sun.awt.DrawingSurfaceInfo;

import sun.awt.DrawingSurface;

import sun.awt.windows.WDrawingSurfaceInfo;

//...

public static int getHwnd(Frame window)

{

//Credit goes to http://community.borland.com/article/0,1410,20679,00.html

DrawingSurfaceInfo w = (DrawingSurfaceInfo)

((DrawingSurface) window.getPeer()).getDrawingSurfaceInfo();

w.lock();

WDrawingSurfaceInfo win32 = (WDrawingSurfaceInfo) w;

int hwnd = win32.getHWnd();

w.unlock();

return hwnd;

}

bhalbright at 2007-7-2 16:55:37 > top of Java-index,Java Mobility Forums,Java ME Technologies...