< prev index next >

src/java.desktop/windows/native/libawt/windows/awt_Desktop.cpp

Print this page

        

*** 26,42 **** --- 26,71 ---- #include "jni_util.h" #include "awt.h" #include <jni.h> #include <shellapi.h> #include <float.h> + #include "awt_Toolkit.h" + + #define NOTIFY_FOR_ALL_SESSIONS 1 + #define NOTIFY_FOR_THIS_SESSION 0 + + typedef BOOL (WINAPI *WTSRegisterSessionNotification)(HWND,DWORD); + static WTSRegisterSessionNotification fn_WTSRegisterSessionNotification; #ifdef __cplusplus extern "C" { #endif /* * Class: sun_awt_windows_WDesktopPeer + * Method: init + * Signature: ()V + */ + JNIEXPORT void JNICALL Java_sun_awt_windows_WDesktopPeer_init + (JNIEnv *, jclass) { + static HMODULE libWtsapi32 = NULL; + if (libWtsapi32 == NULL) { + libWtsapi32 = JDK_LoadSystemLibrary("Wtsapi32.dll"); + if (libWtsapi32) { + fn_WTSRegisterSessionNotification = (WTSRegisterSessionNotification) + GetProcAddress(libWtsapi32, "WTSRegisterSessionNotification"); + if (fn_WTSRegisterSessionNotification) { + HWND hwnd = AwtToolkit::GetInstance().GetHWnd(); + //used for UserSessionListener + fn_WTSRegisterSessionNotification(hwnd, NOTIFY_FOR_THIS_SESSION); + } + } + } + } + + /* + * Class: sun_awt_windows_WDesktopPeer * Method: ShellExecute * Signature: (Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String; */ JNIEXPORT jstring JNICALL Java_sun_awt_windows_WDesktopPeer_ShellExecute (JNIEnv *env, jclass cls, jstring fileOrUri_j, jstring verb_j)
< prev index next >