package com.sun.jna.platform.win32;

import java.awt.Frame;

import com.sun.jna.Native;
import junit.framework.TestCase;

import com.sun.jna.Pointer;
import com.sun.jna.platform.win32.WinDef.HWND;

public class Wtsapi32Test extends TestCase {

	private final long peer;

	private final HWND hwnd;

	public static void main(String[] args) {
		junit.textui.TestRunner.run(Wtsapi32Test.class);
	}

	public Wtsapi32Test() {
		Frame frame = new Frame();
		frame.setVisible(true);
		this.peer = Native.getWindowID(frame);
		this.hwnd = new HWND(new Pointer(peer));
	}

	public void testWTSRegisterSessionNotification() {
		boolean result = Wtsapi32.INSTANCE.WTSRegisterSessionNotification(hwnd,
				Wtsapi32.NOTIFY_FOR_ALL_SESSIONS);
		assertEquals(true, result);
	}

	public void testWTSUnRegisterSessionNotification() {
		// needed to register before you can unregister!
		testWTSRegisterSessionNotification();
		boolean result = Wtsapi32.INSTANCE
				.WTSUnRegisterSessionNotification(hwnd);

		assertEquals(true, result);
	}
}

@@ -253,38 +253,12 @@
 %0D%0A%0D%0A
-%09private final long peer;%0D%0A%0D%0A%09
+    
 priv
@@ -476,78 +476,48 @@
 his.
-peer = Native.getWindowID(frame);%0D%0A%09%09this.hwnd = new HWND(new 
+hwnd = new HWND(Native.getWindow
 Pointer(
 peer
@@ -516,12 +516,13 @@
 ter(
-peer
+frame
 ));%0D

remove unused reference to peer.