import kotlinx.cinterop.*
import platform.windows.*
@OptIn(ExperimentalForeignApi::class)
actual fun showDialog(content: String): Unit = memScoped {
// 分配 MAX_COMPUTERNAME_LENGTH + 1 的空间来存放计算机名,这是计算机名 API 的要求
val infoBuf = UShortArray(MAX_COMPUTERNAME_LENGTH + 1)
val infoPtr = infoBuf.refTo(0).getPointer(this)
// 分配 DWORD 到 LP(left pointer)
val bufPtr: LPDWORD = alloc<DWORDVar>().ptr
// 给这个内存填上 UInt 值,告诉 buf 有多大
bufPtr[0] = (MAX_COMPUTERNAME_LENGTH + 1).toUInt()
GetComputerNameW(infoPtr, bufPtr) // 调用 Windows API GetComputerNameW
// 将 output(infoBuf) 指针(infoPtr)转换为 Kotlin String
val name = infoPtr.toKString() // 当然你也可以直接一个个访问内存拿到 UShort 转 Char
// 访问 MessageBoxW Api 输出内容
MessageBoxW(null, "$content\ncomputerName: $name!", content, MB_OK.toUInt())