diff options
Diffstat (limited to 'src/mingwMain/kotlin/moe.yuuta.desktop/Desktop.kt')
-rw-r--r-- | src/mingwMain/kotlin/moe.yuuta.desktop/Desktop.kt | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/src/mingwMain/kotlin/moe.yuuta.desktop/Desktop.kt b/src/mingwMain/kotlin/moe.yuuta.desktop/Desktop.kt new file mode 100644 index 0000000..ecef5fd --- /dev/null +++ b/src/mingwMain/kotlin/moe.yuuta.desktop/Desktop.kt @@ -0,0 +1,37 @@ +package moe.yuuta.desktop + +import platform.posix.printf +import platform.windows.* +import kotlin.native.concurrent.TransferMode +import kotlin.native.concurrent.Worker + +@Suppress("unused") +fun main() { + printf("Secure Desktop demo by i@yuuta.moe") + val oldDesktop = GetThreadDesktop(GetCurrentThreadId()) + val newDesktop = CreateDesktopA("desktop_dialog", + null, + null, + 0, + (DESKTOP_READOBJECTS or + DESKTOP_CREATEWINDOW or + DESKTOP_CREATEMENU or + DESKTOP_HOOKCONTROL or + DESKTOP_JOURNALRECORD or + DESKTOP_JOURNALPLAYBACK or + DESKTOP_ENUMERATE or + DESKTOP_WRITEOBJECTS or + DESKTOP_SWITCHDESKTOP).toUInt(), + null) + SwitchDesktop(newDesktop) + Worker.start().execute(TransferMode.SAFE, { newDesktop }) { + SetThreadDesktop(it) + MessageBoxA(null, + "Hi! This is message from thread ${GetCurrentThreadId()} in the secure desktop.", + "Secure Desktop", + (MB_OK or MB_ICONINFORMATION).toUInt()) + }.consume { + SwitchDesktop(oldDesktop) + CloseDesktop(newDesktop) + } +}
\ No newline at end of file |